ProducerFactory   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\JobProducer;
9
use Antidot\Queue\Producer;
10
use Psr\Container\ContainerInterface;
11
12
class ProducerFactory
13
{
14 1
    public function __invoke(
15
        ContainerInterface $container,
16
        string $contextName = ConfigProvider::DEFAULT_CONTEXT
17
    ): Producer {
18 1
        $contextConfig = ConfigProvider::getContextConfig($contextName, $container->get(ConfigProvider::CONFIG_KEY));
19 1
        $context = $container->get($contextConfig[ConfigProvider::CONTEXT_SERVICE_KEY]);
20
21 1
        return new JobProducer($context);
22
    }
23
}
24