| Conditions | 6 |
| Paths | 6 |
| Total Lines | 27 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php declare(strict_types=1); |
||
| 32 | public function getListeners(string $eventClass): iterable |
||
| 33 | { |
||
| 34 | $listeners = []; |
||
| 35 | |||
| 36 | foreach ($this->listeners as $listener) { |
||
| 37 | if ($eventClass === $listener->getEventClass()) { |
||
| 38 | $listeners[] = $listener; |
||
| 39 | } |
||
| 40 | } |
||
| 41 | |||
| 42 | usort($listeners, function (RegisteredListener $first, RegisteredListener $second) { |
||
| 43 | if ($first->getPriority() < $second->getPriority()) { |
||
| 44 | return -1; |
||
| 45 | } |
||
| 46 | |||
| 47 | if ($first->getPriority() > $second->getPriority()) { |
||
| 48 | return 1; |
||
| 49 | } |
||
| 50 | |||
| 51 | return 0; |
||
| 52 | }); |
||
| 53 | |||
| 54 | foreach ($listeners as $key => $listener) { |
||
| 55 | $listeners[$key] = $listener->getListener(); |
||
| 56 | } |
||
| 57 | |||
| 58 | return $listeners; |
||
| 59 | } |
||
| 61 |