1: <?php
2:
3: namespace ModHelper;
4:
5: 6: 7: 8:
9: class Hooks
10: {
11: protected $hooks = array();
12: protected $collection;
13:
14: public function execute($add)
15: {
16: foreach ($this->collection as list ($hook, $function, $permanent)) {
17: if ($add) {
18: add_integration_function($hook, $function, $permanent);
19: } else {
20: remove_integration_function($hook, $function, $permanent);
21: }
22: }
23: }
24:
25: public function add($hook, $function, $permanent = true)
26: {
27: $this->collection->addValue([$hook, $function, $permanent]);
28:
29: return $this;
30: }
31:
32: public function __construct()
33: {
34: $this->collection = new Collection();
35:
36: return $this;
37: }
38:
39: }
40: