ConfigurationFactory   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 16 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Fabiang\DoctrineDynamic\Service;
6
7
use Fabiang\DoctrineDynamic\Configuration;
8
use Fabiang\DoctrineDynamic\ConfigurationFactory as BaseConfigurationFactory;
9
use Laminas\ServiceManager\Factory\FactoryInterface;
10
use Psr\Container\ContainerInterface;
11
12
use function is_array;
13
14
class ConfigurationFactory extends BaseConfigurationFactory implements
15
    FactoryInterface
16
{
17
    /**
18
     * @param string $requestedName
19
     */
20 1
    public function __invoke(
21
        ContainerInterface $container,
22
        $requestedName,
23
        ?array $options = null
24
    ): Configuration {
25 1
        $globalConfiguration = $container->get('configuration');
26
27 1
        $configuration = [];
28
        if (
29 1
            isset($globalConfiguration['doctrine_dynamic'])
30 1
            && is_array($globalConfiguration['doctrine_dynamic'])
31
        ) {
32 1
            $configuration = $globalConfiguration['doctrine_dynamic'];
33
        }
34
35 1
        return $this->factory($configuration);
36
    }
37
}
38