ChainBuilderCompiler::process()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 7
rs 10
cc 2
nc 2
nop 1
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
}