Completed
Push — ezp25946-migrate_files_to_othe... ( 56a30c...6cf922 )
by
unknown
24:31
created

RouterPass   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 13
rs 10
c 1
b 0
f 0
wmc 2
lcom 0
cbo 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 10 2
1
<?php
2
3
/**
4
 * File containing the RouterPass class.
5
 *
6
 * @copyright Copyright (C) eZ Systems AS. All rights reserved.
7
 * @license For full copyright and license information view LICENSE file distributed with this source code.
8
 */
9
namespace eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Compiler;
10
11
use eZ\Bundle\EzPublishCoreBundle\Routing\DefaultRouter;
12
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
13
use Symfony\Component\DependencyInjection\ContainerBuilder;
14
15
/**
16
 * Routing related compiler pass.
17
 *
18
 * Manipulates Symfony default router services to adapt them to eZ routing needs,
19
 * specifically to implement the RequestMatcherInterface.
20
 */
21
class RouterPass implements CompilerPassInterface
22
{
23
    public function process(ContainerBuilder $container)
24
    {
25
        if (!$container->hasDefinition('router.default')) {
26
            return;
27
        }
28
29
        $container
30
            ->findDefinition('router.default')
31
            ->setClass(DefaultRouter::class);
32
    }
33
}
34