DashboardBlocksCompilerPass   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 14 14 3

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
/*
4
 * This file is part of the Blast Project package.
5
 *
6
 * Copyright (C) 2015-2017 Libre Informatique
7
 *
8
 * This file is licenced under the GNU LGPL v3.
9
 * For the full copyright and license information, please view the LICENSE.md
10
 * file that was distributed with this source code.
11
 */
12
13
namespace Blast\CoreBundle\DependencyInjection;
14
15
use Symfony\Component\DependencyInjection\ContainerBuilder;
16
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
17
use Symfony\Component\DependencyInjection\Reference;
18
19 View Code Duplication
class DashboardBlocksCompilerPass 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...
20
{
21
    public function process(ContainerBuilder $container)
22
    {
23
        if (!$container->has('blast_core.dashboard.registry')) {
24
            return;
25
        }
26
27
        $registry = $container->findDefinition('blast_core.dashboard.registry');
28
29
        $taggedServices = $container->findTaggedServiceIds('blast.dashboard_block');
30
31
        foreach ($taggedServices as $id => $tags) {
32
            $registry->addMethodCall('registerBlock', [new Reference($id)]);
33
        }
34
    }
35
}
36