Conditions | 3 |
Paths | 4 |
Total Lines | 15 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
18 | public function addHandler( |
||
19 | callable | string $event, |
||
20 | ?callable $function |
||
21 | ): void { |
||
22 | if (is_callable($event)) { |
||
23 | $function = $event; |
||
24 | $event = '*'; |
||
25 | } |
||
26 | |||
27 | if (!array_key_exists($event, $this->eventHandlers)) { |
||
|
|||
28 | $this->eventHandlers[$event] = []; |
||
29 | } |
||
30 | |||
31 | /** @psalm-suppress InvalidPropertyAssignmentValue */ |
||
32 | $this->eventHandlers[$event][] = $function; |
||
33 | } |
||
49 |