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