RegisterFactorsPass   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 0
cbo 3
dl 0
loc 19
ccs 8
cts 8
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 13 2
1
<?php
2
declare(strict_types = 1);
3
4
namespace Innmind\HomeostasisBundle\DependencyInjection\Compiler;
5
6
use Symfony\Component\DependencyInjection\{
7
    ContainerBuilder,
8
    Compiler\CompilerPassInterface,
9
    Reference
10
};
11
12
final class RegisterFactorsPass implements CompilerPassInterface
13
{
14
    /**
15
     * {@inheritdoc}
16
     */
17 4
    public function process(ContainerBuilder $container)
18
    {
19 4
        $services = $container->findTaggedServiceIds('innmind.homeostasis.factor');
20 4
        $factors = [];
21
22 4
        foreach ($services as $id => $tags) {
23 4
            $factors[] = new Reference($id);
24
        }
25
26
        $container
27 4
            ->getDefinition('innmind.homeostasis.regulator.default')
28 4
            ->replaceArgument(0, $factors);
29 4
    }
30
}
31