Kernel::configureRoutes()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 9
rs 10
cc 3
nc 3
nop 1
1
<?php
2
3
/*
4
 * This file is part of the TheAlternativeZurich/events project.
5
 *
6
 * (c) Florian Moser <[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 App;
13
14
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
15
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
16
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
17
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
18
19
class Kernel extends BaseKernel
20
{
21
    use MicroKernelTrait;
0 ignored issues
show
Bug introduced by
The trait Symfony\Bundle\Framework...Kernel\MicroKernelTrait requires the property $instanceof which is not provided by App\Kernel.
Loading history...
22
23
    protected function configureContainer(ContainerConfigurator $container): void
24
    {
25
        $container->import('../config/{packages}/*.yaml');
26
        $container->import('../config/{packages}/'.$this->environment.'/*.yaml');
27
28
        if (is_file(\dirname(__DIR__).'/config/services.yaml')) {
29
            $container->import('../config/{services}.yaml');
30
            $container->import('../config/{services}_'.$this->environment.'.yaml');
31
        } elseif (is_file($path = \dirname(__DIR__).'/config/services.php')) {
32
            (require $path)($container->withPath($path), $this);
33
        }
34
    }
35
36
    protected function configureRoutes(RoutingConfigurator $routes): void
37
    {
38
        $routes->import('../config/{routes}/'.$this->environment.'/*.yaml');
39
        $routes->import('../config/{routes}/*.yaml');
40
41
        if (is_file(\dirname(__DIR__).'/config/routes.yaml')) {
42
            $routes->import('../config/{routes}.yaml');
43
        } elseif (is_file($path = \dirname(__DIR__).'/config/routes.php')) {
44
            (require $path)($routes->withPath($path), $this);
45
        }
46
    }
47
}
48