Passed
Push — develop ( 7d2e81...61e6f0 )
by Laurent
06:22 queued 03:53
created

Kernel   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 15
dl 0
loc 26
rs 10
c 1
b 0
f 0
wmc 6

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configureRoutes() 0 9 3
A configureContainer() 0 10 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Core\Infrastructure;
6
7
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
8
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
9
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
10
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
11
12
class Kernel extends BaseKernel
13
{
14
    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 Core\Infrastructure\Kernel.
Loading history...
15
16
    protected function configureContainer(ContainerConfigurator $container): void
17
    {
18
        $container->import('../../../config/{packages}/*.yaml');
19
        $container->import('../../../config/{packages}/' . $this->environment . '/*.yaml');
20
21
        if (\is_file(\dirname(__DIR__, 3) . '/config/services.yaml')) {
22
            $container->import('../../../config/services.yaml');
23
            $container->import('../../../config/{services}_' . $this->environment . '.yaml');
24
        } elseif (\is_file($path = \dirname(__DIR__, 3) . '/config/services.php')) {
25
            (require $path)($container->withPath($path), $this);
26
        }
27
    }
28
29
    protected function configureRoutes(RoutingConfigurator $routes): void
30
    {
31
        $routes->import('../../../config/{routes}/' . $this->environment . '/*.yaml');
32
        $routes->import('../../../config/{routes}/*.yaml');
33
34
        if (\is_file(\dirname(__DIR__, 3) . '/config/routes.yaml')) {
35
            $routes->import('../../../config/routes.yaml');
36
        } elseif (\is_file($path = \dirname(__DIR__, 3) . '/config/routes.php')) {
37
            (require $path)($routes->withPath($path), $this);
38
        }
39
    }
40
}
41