| Conditions | 6 |
| Paths | 6 |
| Total Lines | 14 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 5 |
| CRAP Score | 6 |
| Changes | 0 | ||
| 1 | <?php |
||
| 29 | public function __invoke(ContainerInterface $container): SendersLocatorInterface |
||
| 30 | 5 | { |
|
| 31 | /** @var array<string, mixed> $config */ |
||
| 32 | 5 | $config = $container->has('config') ? $container->get('config') : []; |
|
| 33 | 2 | /** @var string[][]|array<string, string[]> $routing */ |
|
| 34 | 1 | $routing = $config['messenger']['buses'][$this->busName]['routes'] ?? []; |
|
| 35 | |||
| 36 | foreach ($routing as $message => $_) { |
||
| 37 | if ('*' !== $message && ! class_exists((string) $message) && ! interface_exists((string) $message, false)) { |
||
| 38 | 4 | throw new LogicException(sprintf('Invalid Messenger routing configuration: class or interface "%s" not found.', $message)); |
|
| 39 | } |
||
| 40 | } |
||
| 41 | |||
| 42 | return new SendersLocator($routing, $container); |
||
| 43 | } |
||
| 45 |