AdminCompilerPass   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 4
c 2
b 0
f 1
lcom 0
cbo 3
dl 0
loc 26
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B process() 0 23 4
1
<?php
2
3
namespace Ob\CmsBundle\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 AdminCompilerPass implements CompilerPassInterface
10
{
11
    public function process(ContainerBuilder $container)
12
    {
13
        if (!$container->hasDefinition('ob.cms.admin_container')) {
14
            return;
15
        }
16
17
        $definition = $container->getDefinition(
18
            'ob.cms.admin_container'
19
        );
20
21
        $taggedServices = $container->findTaggedServiceIds(
22
            'ob.cms.admin'
23
        );
24
25
        foreach ($taggedServices as $id => $tagAttributes) {
26
            foreach ($tagAttributes as $attributes) {
27
                $definition->addMethodCall(
28
                    'addClass',
29
                    array(new Reference($id), $attributes["alias"])
30
                );
31
            }
32
        }
33
    }
34
}
35