RuleFunctionPass   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 0
dl 0
loc 14
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 11 3
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