Conditions | 4 |
Paths | 4 |
Total Lines | 16 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 4 |
Changes | 0 |
1 | <?php |
||
13 | 34 | public static function getDispatcher(SetupGacela $setupGacela): EventDispatcherInterface |
|
14 | { |
||
15 | 34 | if (!$setupGacela->canCreateEventDispatcher()) { |
|
16 | 23 | return new NullEventDispatcher(); |
|
17 | } |
||
18 | |||
19 | 11 | $dispatcher = new ConfigurableEventDispatcher(); |
|
20 | 11 | $dispatcher->registerGenericListeners($setupGacela->getGenericListeners() ?? []); |
|
21 | |||
22 | 11 | foreach ($setupGacela->getSpecificListeners() ?? [] as $event => $listeners) { |
|
23 | 5 | foreach ($listeners as $callable) { |
|
24 | 5 | $dispatcher->registerSpecificListener($event, $callable); |
|
25 | } |
||
26 | } |
||
27 | |||
28 | 11 | return $dispatcher; |
|
29 | } |
||
31 |