PrimeConfigurator   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Test Coverage

Coverage 61.53%

Importance

Changes 2
Bugs 0 Features 1
Metric Value
eloc 11
c 2
b 0
f 1
dl 0
loc 39
ccs 8
cts 13
cp 0.6153
rs 10
wmc 5

3 Methods

Rating   Name   Duplication   Size   Complexity  
A configurePrime() 0 6 2
A __construct() 0 3 1
A configureHydrator() 0 9 2
1
<?php
2
3
namespace Bdf\PrimeBundle\Configurator;
4
5
use Bdf\Prime\ServiceLocator;
6
use Symfony\Component\DependencyInjection\ContainerInterface;
7
8
class PrimeConfigurator
9
{
10
    /**
11
     * @var ContainerInterface
12
     */
13
    private $container;
14
15
    /**
16
     * PrimeFactory constructor.
17
     */
18 10
    public function __construct(ContainerInterface $container)
19
    {
20 10
        $this->container = $container;
21
    }
22
23
    /**
24
     * Create the repository instance.
25
     */
26 10
    public function configurePrime(ServiceLocator $service)
27
    {
28 10
        $loader = $this->container->getParameter('prime.hydrators');
29
30 10
        if ($loader) {
31 10
            $this->configureHydrator($service, $loader);
32
        }
33
    }
34
35
    /**
36
     * Create the repository instance.
37
     */
38 10
    private function configureHydrator(ServiceLocator $service, string $loader)
39
    {
40 10
        if (is_file($loader)) {
41
            $launcher = function () use ($service, $loader) {
42
                $registry = $service->hydrators();
43
44
                include $loader;
45
            };
46
            $launcher();
47
        }
48
    }
49
}
50