Completed
Push — master ( 1de9b7...830752 )
by Kristof
38:46 queued 24:09
created

MenuCompilerPass::process()   A

Complexity

Conditions 4
Paths 4

Size

Total Lines 14

Duplication

Lines 14
Ratio 100 %

Importance

Changes 0
Metric Value
dl 14
loc 14
rs 9.7998
c 0
b 0
f 0
cc 4
nc 4
nop 1
1
<?php
2
3
namespace Kunstmaan\AdminBundle\DependencyInjection\Compiler;
4
5
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
6
use Symfony\Component\DependencyInjection\ContainerBuilder;
7
use Symfony\Component\DependencyInjection\Reference;
8
9
/**
10
 * This compiler pass makes it possible to adapt the menu
11
 */
12 View Code Duplication
class MenuCompilerPass implements CompilerPassInterface
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
13
{
14
    /**
15
     * @param ContainerBuilder $container
16
     */
17
    public function process(ContainerBuilder $container)
18
    {
19
        if (!$container->hasDefinition('kunstmaan_admin.menubuilder')) {
20
            return;
21
        }
22
23
        $definition = $container->getDefinition('kunstmaan_admin.menubuilder');
24
25
        foreach ($container->findTaggedServiceIds('kunstmaan_admin.menu.adaptor') as $id => $attributes) {
26
            $priority = isset($attributes[0]['priority']) ? $attributes[0]['priority'] : 0;
27
28
            $definition->addMethodCall('addAdaptMenu', array(new Reference($id), $priority));
29
        }
30
    }
31
}
32