Total Complexity | 4 |
Total Lines | 28 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
12 | final class EventDispatcher extends AbstractEventDispatcher implements AddListenerAwareInterface |
||
13 | { |
||
14 | public function __construct(private readonly AddableListenerProviderInterface $listenerProvider) |
||
15 | { |
||
16 | } |
||
17 | |||
18 | /** |
||
19 | * @throws EventListenerException |
||
20 | */ |
||
21 | public function addListenerForEvent(object|string $event, callable $listener, int $priority = 1): void |
||
22 | { |
||
23 | $this->listenerProvider->addListenerForEvent($event, $listener, $priority); |
||
24 | } |
||
25 | |||
26 | 12 | /** |
|
27 | * @throws EventListenerException |
||
28 | 12 | */ |
|
29 | public function addListenersForEvent(string|object $event, iterable $listeners, int $priority = 1): void |
||
30 | { |
||
31 | $this->listenerProvider->addListenersForEvent($event, $listeners, $priority); |
||
32 | } |
||
33 | |||
34 | /** |
||
35 | * @return ListenerProviderInterface |
||
36 | */ |
||
37 | protected function getListenerProvider(): ListenerProviderInterface |
||
40 | 1 | } |
|
41 | } |
||
42 |