SymfonyRouterPass::process()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 17
Code Lines 9

Duplication

Lines 17
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 17
loc 17
rs 9.4285
cc 3
eloc 9
nc 3
nop 1
1
<?php
2
3
/*
4
 * This file is part of the Tadcka package.
5
 *
6
 * (c) Tadas Gliaubicas <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Tadcka\Bundle\RoutingBundle\DependencyInjection\Compiler;
13
14
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
15
use Symfony\Component\DependencyInjection\ContainerBuilder;
16
17
/**
18
 * @author Tadas Gliaubicas <[email protected]>
19
 *
20
 * @since 7/11/14 10:00 PM
21
 */
22 View Code Duplication
class SymfonyRouterPass 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
    /**
26
     * {@inheritdoc}
27
     */
28
    public function process(ContainerBuilder $container)
29
    {
30
        if ($container->getParameter('tadcka_routing.chain_router.enabled')) {
31
            if (false === $container->hasDefinition('router.default')) {
32
                return null;
33
            }
34
35
            $symfonyRouter = $container->getDefinition('router.default');
36
37
            $symfonyRouter->addTag(
38
                'router',
39
                array(
40
                    'priority' => $container->getParameter('tadcka_routing.router.priority')
41
                )
42
            );
43
        }
44
    }
45
}
46