Conditions | 6 |
Paths | 14 |
Total Lines | 25 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
21 | protected function doDispatch($listeners, $eventName, Event $event) |
||
22 | { |
||
23 | /** |
||
24 | * Array of arrays of type [$callable, $reason] |
||
25 | */ |
||
26 | $failedListeners = []; |
||
27 | |||
28 | foreach ($listeners as $listener) { |
||
29 | try { |
||
30 | call_user_func($listener, $event, $eventName, $this); |
||
31 | } catch (Throwable $t) { |
||
|
|||
32 | $failedListeners[] = [$listener, $t]; |
||
33 | } catch (Exception $e) { |
||
34 | $failedListeners[] = [$listener, $e]; |
||
35 | } |
||
36 | |||
37 | if ($event->isPropagationStopped()) { |
||
38 | break; |
||
39 | } |
||
40 | } |
||
41 | |||
42 | if (!empty($failedListeners)) { |
||
43 | throw new AggregateRootEventException($eventName, $event, $failedListeners); |
||
44 | } |
||
45 | } |
||
46 | } |