Completed
Push — master ( 770316...74fc07 )
by Jeroen
09:08 queued 02:44
created

Compiler/AdminPanelCompilerPass.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

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 add items to the admin panel
11
 */
12 View Code Duplication
class AdminPanelCompilerPass implements CompilerPassInterface
0 ignored issues
show
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 5
    public function process(ContainerBuilder $container)
18
    {
19 5
        if (!$container->hasDefinition('kunstmaan_admin.admin_panel')) {
20 1
            return;
21
        }
22
23 4
        $definition = $container->getDefinition('kunstmaan_admin.admin_panel');
24
25 4
        foreach ($container->findTaggedServiceIds('kunstmaan_admin.admin_panel.adaptor') as $id => $attributes) {
26 4
            $priority = isset($attributes[0]['priority']) ? $attributes[0]['priority'] : 0;
27
28 4
            $definition->addMethodCall('addAdminPanelAdaptor', array(new Reference($id), $priority));
29
        }
30 4
    }
31
}
32