| Conditions | 4 |
| Paths | 8 |
| Total Lines | 22 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 4 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 16 | 3 | public function __invoke(ContainerInterface $container): EventDispatcherInterface |
|
| 17 | { |
||
| 18 | /** @var array $config */ |
||
| 19 | 3 | $config = $container->has('config') ? $container->get('config') : []; |
|
| 20 | |||
| 21 | 3 | $eventDispatcher = new EventDispatcher(); |
|
| 22 | |||
| 23 | 3 | $eventDispatcher->addSubscriber($container->get(SendFailedMessageForRetryListener::class)); |
|
| 24 | |||
| 25 | 3 | $failureTransport = $config['messenger']['failure_transport'] ?? null; |
|
| 26 | |||
| 27 | 3 | if ($failureTransport) { |
|
| 28 | 1 | $eventDispatcher->addSubscriber($container->get(SendFailedMessageToFailureTransportListener::class)); |
|
| 29 | } |
||
| 30 | |||
| 31 | 3 | $cachePoolForRestartSignal = $config['messenger']['cache_pool_for_restart_signal'] ?? null; |
|
| 32 | |||
| 33 | 3 | if ($cachePoolForRestartSignal) { |
|
| 34 | 1 | $eventDispatcher->addSubscriber($container->get(StopWorkerOnRestartSignalListener::class)); |
|
| 35 | } |
||
| 36 | |||
| 37 | 3 | return $eventDispatcher; |
|
| 38 | } |
||
| 40 |