Passed
Branch master (6be21c)
by Nikita
04:25
created

TpgExtjsBundle::build()   B

Complexity

Conditions 5
Paths 1

Size

Total Lines 24
Code Lines 15

Duplication

Lines 12
Ratio 50 %

Importance

Changes 4
Bugs 2 Features 2
Metric Value
c 4
b 2
f 2
dl 12
loc 24
rs 8.5125
cc 5
eloc 15
nc 1
nop 1
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
    public function build(ContainerBuilder $builder)
14
    {
15
16
        parent::build($builder);
17
18
        $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
                if ($container->hasDefinition("tpg_extjs.orm_serializer"))
21
                    $container->getDefinition('tpg_extjs.orm_serializer')->replaceArgument(3, $def);
22
                if ($container->hasDefinition("tpg_extjs.odm_serializer"))
23
                    $container->getDefinition('tpg_extjs.odm_serializer')->replaceArgument(3, $def);
24
            }
25
        ));
26
        $builder->addCompilerPass(new LazyServiceMapPass('tpg_extjs.deserialization_visitor', 'format',
27 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
                if ($container->hasDefinition("tpg_extjs.orm_serializer"))
29
                    $container->getDefinition('tpg_extjs.orm_serializer')->replaceArgument(4, $def);
30
                if ($container->hasDefinition("tpg_extjs.odm_serializer"))
31
                    $container->getDefinition('tpg_extjs.odm_serializer')->replaceArgument(4, $def);
32
            }
33
        ));
34
35
        $builder->addCompilerPass(new SerializerParserPass());
36
    }
37
}
38