ConfigGroupCompilerPass::process()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 3
eloc 5
c 1
b 0
f 0
nc 3
nop 1
dl 0
loc 10
rs 10
1
<?php
2
3
namespace Xiidea\EasyConfigBundle\DependencyInjection\Compiler;
4
5
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
6
use Symfony\Component\DependencyInjection\ContainerBuilder;
7
use Symfony\Component\DependencyInjection\Reference;
8
9
class ConfigGroupCompilerPass implements CompilerPassInterface
10
{
11
    public function process(ContainerBuilder $container): void
12
    {
13
        if (false === $container->hasDefinition('xiidea.easy_config.service_manager')) {
14
            return;
15
        }
16
17
        $definition = $container->getDefinition('xiidea.easy_config.service_manager');
18
19
        foreach ($container->findTaggedServiceIds('xiidea.easy_config.group') as $id => $attributes) {
20
            $definition->addMethodCall('addConfigGroup', [new Reference($id)]);
21
        }
22
    }
23
}
24