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

RouterPass::process()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 6
nc 2
nop 1
dl 0
loc 10
rs 9.4285
c 1
b 0
f 0
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