1 | <?php |
||
4 | class Hook |
||
5 | { |
||
6 | |||
7 | /** |
||
8 | * @var string |
||
9 | */ |
||
10 | protected $tag; |
||
11 | |||
12 | /** |
||
13 | * @var array |
||
14 | */ |
||
15 | protected $hooks = []; |
||
16 | |||
17 | |||
18 | /** |
||
19 | * Hook constructor. |
||
20 | * @param string $tag |
||
21 | */ |
||
22 | 64 | public function __construct($tag) |
|
26 | |||
27 | /** |
||
28 | * @param int $priority |
||
29 | * @param string $callback |
||
30 | */ |
||
31 | 64 | public function addHook($priority = 10, $callback = '') |
|
39 | |||
40 | /** |
||
41 | * Return all hooks |
||
42 | * |
||
43 | * @return array |
||
44 | */ |
||
45 | 64 | public function getHooks() |
|
49 | |||
50 | /** |
||
51 | * Remove a given hook with a callback and priority. |
||
52 | * |
||
53 | * @param int $priority |
||
54 | * @param string $callback |
||
55 | */ |
||
56 | 8 | public function removeCallbackWithPriority($priority = 10, $callback = '') |
|
78 | |||
79 | /** |
||
80 | * Remove all known hooks. |
||
81 | */ |
||
82 | 44 | public function removeAllHooks() |
|
86 | } |
||
87 |
When comparing two booleans, it is generally considered safer to use the strict comparison operator.