MessageProcessorFactory::__invoke()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 8
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
crap 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