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

StartQueueConsumerFactory::__invoke()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 10
ccs 6
cts 6
cp 1
rs 10
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\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