Completed
Push — master ( ae4a40...cd3ab6 )
by Tristan
13:24 queued 09:52
created

DynamicServiceCompilerPass   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 58.82 %

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 10
loc 17
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 10 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
 * MyPoseo API Bundle
5
 *
6
 * @author Tristan Bessoussa <[email protected]>
7
 */
8
9
namespace Tristanbes\MyPoseoBundle\CompilerPass;
10
11
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
12
use Symfony\Component\DependencyInjection\ContainerBuilder;
13
use Symfony\Component\DependencyInjection\Reference;
14
15
/**
16
 * Class DynamicServiceCacheCompilerPass
17
 */
18
class DynamicServiceCompilerPass implements CompilerPassInterface
19
{
20
    public function process(ContainerBuilder $container)
21
    {
22 View Code Duplication
        if ($container->getParameter('my_poseo.api.cache_service_id') != null) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across 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...
23
            $container->getDefinition('my_poseo.search.client')
24
                ->replaceArgument(3, new Reference($container->getParameter('my_poseo.api.cache_service_id'))
25
            );
26
        }
27
28 View Code Duplication
        if ($container->getParameter('my_poseo.api.http_client') != null) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across 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...
29
            $container->getDefinition('my_poseo.search.client')
30
                ->replaceArgument(2, new Reference($container->getParameter('my_poseo.api.http_client'))
31
            );
32
        }
33
    }
34
}
35