Total Complexity | 5 |
Total Lines | 39 |
Duplicated Lines | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
7 | class EventHandlerCollection |
||
8 | { |
||
9 | /** @var array<string, array<int, callable>> */ |
||
10 | private array $eventHandlers = []; |
||
11 | |||
12 | /** |
||
13 | * Register an event handler. |
||
14 | * |
||
15 | * @param callable|string $event The name of the event to listen for. Pass a callable to this parameter to catch all events. |
||
16 | * @param callable|null $function The callable that will be invoked on event |
||
17 | */ |
||
18 | public function addHandler( |
||
33 | } |
||
34 | |||
35 | /** |
||
36 | * Invoke all handlers for a specific event. |
||
37 | */ |
||
38 | public function invoke(Event $event): void |
||
49 |