| Conditions | 3 |
| Paths | 3 |
| Total Lines | 17 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 15 | 1 | public function __invoke(ContainerInterface $container): EventDispatcherInterface |
|
| 16 | { |
||
| 17 | 1 | $config = $container->get('config')['app-events']; |
|
| 18 | 1 | $listenerProvider = new ListenerProvider(); |
|
| 19 | |||
| 20 | 1 | foreach ($config['event-listeners'] as $eventName => $listeners) { |
|
| 21 | 1 | foreach ($listeners as $listenerId) { |
|
| 22 | 1 | $listenerProvider->addListener( |
|
| 23 | 1 | $eventName, |
|
| 24 | static function () use ($container, $listenerId): callable { |
||
| 25 | 1 | return $container->get($listenerId); |
|
| 26 | 1 | } |
|
| 27 | ); |
||
| 28 | } |
||
| 29 | } |
||
| 30 | |||
| 31 | 1 | return new EventDispatcher($listenerProvider); |
|
| 32 | } |
||
| 34 |