Conditions | 3 |
Paths | 4 |
Total Lines | 16 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
18 | 2 | public function __invoke(ContainerInterface $container): FailedMessagesShowCommand |
|
19 | 1 | { |
|
20 | $config = $container->has('config') ? $container->get('config') : []; |
||
21 | $failureTransportName = $config['messenger']['failure_transport'] ?? null; |
||
22 | |||
23 | 1 | if (null === $failureTransportName) { |
|
24 | throw new InvalidArgumentException('Invalid failure_transport name'); |
||
25 | 1 | } |
|
26 | 1 | ||
27 | 1 | /** @var ServiceProviderInterface $receiverLocator */ |
|
28 | $receiverLocator = $container->get('messenger.receivers_locator'); |
||
29 | |||
30 | return new FailedMessagesShowCommand( |
||
31 | $failureTransportName, |
||
32 | new ServiceProvider([ |
||
33 | $failureTransportName => static function () use ($receiverLocator, $failureTransportName) { return $receiverLocator->get($failureTransportName); }, |
||
34 | ]), |
||
38 |