MessageProcessorFactory   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
eloc 4
dl 0
loc 10
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 8 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Antidot\Queue\Container;
6
7
use Antidot\Queue\Container\Config\ConfigProvider;
8
use Antidot\Queue\MessageProcessor;
9
use Psr\Container\ContainerInterface;
10
use Psr\EventDispatcher\EventDispatcherInterface;
11
12
class MessageProcessorFactory
13
{
14 1
    public function __invoke(
15
        ContainerInterface $container,
16
        string $contextName = ConfigProvider::DEFAULT_CONTEXT
17
    ): MessageProcessor {
18 1
        $contextConfig = ConfigProvider::getContextConfig($contextName, $container->get(ConfigProvider::CONFIG_KEY));
19 1
        $actionContainer = $container->get($contextConfig[ConfigProvider::CONTAINER_KEY]);
20
21 1
        return new MessageProcessor($actionContainer, $container->get(EventDispatcherInterface::class));
22
    }
23
}
24