Total Complexity | 5 |
Total Lines | 22 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
8 | final class CompositeDispatcher implements EventDispatcherInterface |
||
9 | { |
||
10 | /** |
||
11 | * @var EventDispatcherInterface[] |
||
12 | */ |
||
13 | private array $dispatchers = []; |
||
14 | |||
15 | 2 | public function dispatch(object $event) |
|
16 | { |
||
17 | 2 | foreach ($this->dispatchers as $dispatcher) { |
|
18 | 2 | if ($event instanceof StoppableEventInterface && $event->isPropagationStopped()) { |
|
19 | 1 | return $event; |
|
20 | } |
||
21 | 2 | $event = $dispatcher->dispatch($event); |
|
22 | } |
||
23 | |||
24 | 1 | return $event; |
|
25 | } |
||
26 | |||
27 | 2 | public function attach(EventDispatcherInterface $dispatcher): void |
|
30 | } |
||
31 | } |
||
32 |