| Total Complexity | 4 |
| Total Lines | 37 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 19 | trait DispatcherTools |
||
| 20 | { |
||
| 21 | /** |
||
| 22 | * Matches the listener register pattern with event |
||
| 23 | * |
||
| 24 | * @param $pattern |
||
| 25 | * @param object $event |
||
| 26 | * @return bool |
||
| 27 | */ |
||
| 28 | protected function match($pattern, object $event): bool |
||
| 29 | { |
||
| 30 | $regEx = str_replace(['\\', '*'], ['\\\\', '(.*)'], $pattern); |
||
| 31 | $regEx = "/$regEx/i"; |
||
| 32 | $name = get_class($event); |
||
| 33 | return (bool) preg_match($regEx, $name); |
||
| 34 | } |
||
| 35 | |||
| 36 | /** |
||
| 37 | * orderedListeners |
||
| 38 | * |
||
| 39 | * @param array $unordered |
||
| 40 | * @return array |
||
| 41 | */ |
||
| 42 | protected function orderedListeners(array $unordered): array |
||
| 56 | } |
||
| 57 | } |
||
| 58 |