TpgExtjsBundle   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 27
Duplicated Lines 44.44 %

Coupling/Cohesion

Components 0
Dependencies 5

Test Coverage

Coverage 100%

Importance

Changes 4
Bugs 2 Features 2
Metric Value
wmc 5
c 4
b 2
f 2
lcom 0
cbo 5
dl 12
loc 27
ccs 19
cts 19
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B build() 12 24 5

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
namespace Tpg\ExtjsBundle;
4
5
use Symfony\Component\DependencyInjection\ContainerBuilder;
6
use Symfony\Component\HttpKernel\Bundle\Bundle;
7
use JMS\DiExtraBundle\DependencyInjection\Compiler\LazyServiceMapPass;
8
use Symfony\Component\DependencyInjection\Definition;
9
use Tpg\ExtjsBundle\DependencyInjection\SerializerParserPass;
10
11
class TpgExtjsBundle extends Bundle
12
{
13 1
    public function build(ContainerBuilder $builder)
14
    {
15
16 1
        parent::build($builder);
17
18 1
        $builder->addCompilerPass(new LazyServiceMapPass('tpg_extjs.serialization_visitor', 'format',
19 View Code Duplication
            function(ContainerBuilder $container, Definition $def) {
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...
20 1
                if ($container->hasDefinition("tpg_extjs.orm_serializer"))
21 1
                    $container->getDefinition('tpg_extjs.orm_serializer')->replaceArgument(3, $def);
22 1
                if ($container->hasDefinition("tpg_extjs.odm_serializer"))
23 1
                    $container->getDefinition('tpg_extjs.odm_serializer')->replaceArgument(3, $def);
24 1
            }
25 1
        ));
26 1
        $builder->addCompilerPass(new LazyServiceMapPass('tpg_extjs.deserialization_visitor', 'format',
27 1 View Code Duplication
            function(ContainerBuilder $container, Definition $def) {
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...
28 1
                if ($container->hasDefinition("tpg_extjs.orm_serializer"))
29 1
                    $container->getDefinition('tpg_extjs.orm_serializer')->replaceArgument(4, $def);
30 1
                if ($container->hasDefinition("tpg_extjs.odm_serializer"))
31 1
                    $container->getDefinition('tpg_extjs.odm_serializer')->replaceArgument(4, $def);
32 1
            }
33 1
        ));
34
35 1
        $builder->addCompilerPass(new SerializerParserPass());
36 1
    }
37
}
38