Completed
Push — master ( d79ecd...9b33ca )
by Davide
12:48
created

Kernel   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 4
dl 0
loc 29
rs 10
c 0
b 0
f 0

2 Methods

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