StartQueueConsumerFactory   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 7
c 1
b 0
f 0
dl 0
loc 13
ccs 7
cts 7
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 11 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Antidot\Queue\Container;
6
7
use Antidot\Queue\Cli\StartQueueConsumer;
8
use Antidot\Queue\Container\Config\ConfigProvider;
9
use Enqueue\Consumption\QueueConsumerInterface;
10
use Interop\Queue\Processor;
11
use Psr\Container\ContainerInterface;
12
use Psr\EventDispatcher\EventDispatcherInterface;
13
14
class StartQueueConsumerFactory
15
{
16 1
    public function __invoke(
17
        ContainerInterface $container,
18
        string $contextName = ConfigProvider::DEFAULT_CONTEXT
19
    ): StartQueueConsumer {
20 1
        $contextConfig = ConfigProvider::getContextConfig($contextName, $container->get(ConfigProvider::CONFIG_KEY));
21
22 1
        return new StartQueueConsumer(
23 1
            $container->get(QueueConsumerInterface::class),
24 1
            $container->get(Processor::class),
25 1
            $container->get($contextConfig[ConfigProvider::CONTEXT_SERVICE_KEY]),
26 1
            $container->get(EventDispatcherInterface::class)
27
        );
28
    }
29
}
30