Conditions | 1 |
Paths | 1 |
Total Lines | 19 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 11 |
CRAP Score | 1 |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
15 | 1 | public function __invoke(ContainerInterface $container): CommandBus |
|
16 | { |
||
17 | /** @var array<string, array> $globalConfig */ |
||
18 | 1 | $globalConfig = $container->get('config'); |
|
19 | 1 | $config = CommandBusConfig::createFromArrayConfig($globalConfig['command_bus']); |
|
20 | |||
21 | /** @psalm-suppress MixedArgumentTypeCoercion */ |
||
22 | 1 | return new CommandBus(array_merge( |
|
23 | 1 | array_map(static function (string $middleware) use ($container) { |
|
24 | 1 | return $container->get($middleware); |
|
25 | 1 | }, $config->getMiddleware()), |
|
26 | [ |
||
27 | 1 | new CommandHandlerMiddleware( |
|
28 | /** @var CommandNameExtractor $nameExtractor */ |
||
29 | 1 | $nameExtractor = $container->get($config->getExtractor()), |
|
30 | /** @var HandlerLocator $locator */ |
||
31 | 1 | $locator = $container->get($config->getLocator()), |
|
32 | /** @var MethodNameInflector $inflector */ |
||
33 | 1 | $inflector = $container->get($config->getInflector()) |
|
34 | ), |
||
39 |