Passed
Push — master ( 9bb7f3...8346df )
by Koldo
02:28
created

StartQueueConsumerFactory   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 10 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
13
class StartQueueConsumerFactory
14
{
15 1
    public function __invoke(
16
        ContainerInterface $container,
17
        string $contextName = ConfigProvider::DEFAULT_CONTEXT
18
    ): StartQueueConsumer {
19 1
        $contextConfig = ConfigProvider::getContextConfig($contextName, $container->get(ConfigProvider::CONFIG_KEY));
20
21 1
        return new StartQueueConsumer(
22 1
            $container->get(QueueConsumerInterface::class),
23 1
            $container->get(Processor::class),
24 1
            $container->get($contextConfig[ConfigProvider::CONTEXT_SERVICE_KEY])
25
        );
26
    }
27
}
28