ReplaceLocaleContextPass::process()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 7

Duplication

Lines 11
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 11
loc 11
ccs 0
cts 10
cp 0
rs 9.4285
cc 2
eloc 7
nc 2
nop 1
crap 6
1
<?php
2
3
/*
4
 * This file is part of the Lug package.
5
 *
6
 * (c) Eric GELOEN <[email protected]>
7
 *
8
 * For the full copyright and license information, please read the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Lug\Bundle\GridBundle\DependencyInjection\Compiler;
13
14
use Lug\Bundle\GridBundle\Context\LocaleContext;
15
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
16
use Symfony\Component\DependencyInjection\ContainerBuilder;
17
use Symfony\Component\DependencyInjection\Reference;
18
19
/**
20
 * @author GeLo <[email protected]>
21
 */
22 View Code Duplication
class ReplaceLocaleContextPass 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...
23
{
24
    /**
25
     * {@inheritdoc}
26
     */
27
    public function process(ContainerBuilder $container)
28
    {
29
        if (!$container->hasDefinition('lug.locale.context')) {
30
            return;
31
        }
32
33
        $container
34
            ->getDefinition('lug.grid.context.locale')
35
            ->setClass(LocaleContext::class)
36
            ->replaceArgument(0, new Reference('lug.locale.context'));
37
    }
38
}
39