Total Complexity | 4 |
Total Lines | 35 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
13 | /** |
||
14 | * @inheritDoc |
||
15 | */ |
||
16 | public function getListenersForEvent(object $event): iterable |
||
17 | { |
||
18 | yield from parent::getListenersForEvent($event); |
||
19 | |||
20 | if (method_exists($event, 'eventName')) { |
||
21 | yield from $this->getListenersForEventName($event->eventName()); |
||
22 | } elseif (method_exists($event, 'getName')) { |
||
23 | yield from $this->getListenersForEventName($event->getName()); |
||
24 | } |
||
25 | yield from $this->getListenersForEventInterfaces($event); |
||
26 | } |
||
27 | |||
28 | /** |
||
29 | * @param string $eventName |
||
30 | * @param callable|string $listener |
||
31 | * @param int $priority |
||
32 | */ |
||
33 | public function addListener(string $eventName, $listener, int $priority = ListenerPriority::NORMAL): void |
||
36 | } |
||
37 | |||
38 | /** |
||
39 | * @param string $eventName |
||
40 | * @param callable|string $listener |
||
41 | * @param int $priority |
||
42 | */ |
||
43 | public function listen(string $eventName, $listener, int $priority = ListenerPriority::NORMAL): void |
||
46 | } |
||
47 | } |
||
48 |