ChainBuilderCompiler   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 6
c 1
b 0
f 0
dl 0
loc 14
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 7 2
1
<?php
2
3
4
namespace Oliverde8\PhpEtlBundle\DependencyInjection\Compiler;
5
6
7
use Oliverde8\Component\PhpEtl\ChainBuilder;
8
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
9
use Symfony\Component\DependencyInjection\ContainerBuilder;
10
use Symfony\Component\DependencyInjection\Reference;
11
12
class ChainBuilderCompiler implements CompilerPassInterface
13
{
14
    public const TAG = "etl.operation-factory";
15
16
    /**
17
     * You can modify the container here before it is dumped to PHP code.
18
     */
19
    public function process(ContainerBuilder $container)
20
    {
21
        $chainBuilderDefinition = $container->getDefinition(ChainBuilder::class);
22
        $factories = $container->findTaggedServiceIds(self::TAG);
23
24
        foreach ($factories as $id => $config) {
25
            $chainBuilderDefinition->addMethodCall("registerFactory", [new Reference($id)]);
26
        }
27
    }
28
}