RuleFunctionPass::process()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 11
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 6
nc 3
nop 1
1
<?php
2
3
namespace nicoSWD\RuleBundle\DependencyInjection\Compiler;
4
5
use Symfony\Component\DependencyInjection\ContainerBuilder;
6
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
7
8
class RuleFunctionPass implements CompilerPassInterface
9
{
10
    public function process(ContainerBuilder $container)
11
    {
12
        if ($container->has('nico_swd.rules.parser')) {
13
            $definition = $container->findDefinition('nico_swd.rules.parser');
14
            $serviceIds = array_keys($container->findTaggedServiceIds('nico_swd.rule.function'));
15
16
            foreach ($serviceIds as $serviceId) {
17
                $definition->addMethodCall('registerFunctionClass', [get_class($container->get($serviceId))]);
18
            }
19
        }
20
    }
21
}
22