Kernel::getLogDir()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace App;
4
5
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
6
use Symfony\Component\Config\Loader\LoaderInterface;
7
use Symfony\Component\DependencyInjection\ContainerBuilder;
8
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
9
use Symfony\Component\Routing\RouteCollectionBuilder;
10
11
/**
12
 * Class Kernel
13
 *
14
 * @package App
15
 */
16
class Kernel extends BaseKernel
17
{
18
    use MicroKernelTrait;
19
20
    /**
21
     * @const string
22
     */
23
    const CONFIG_EXTS = '.{php,xml,yaml,yml}';
24
25
    /**
26
     * {@inheritdoc}
27
     */
28
    public function getCacheDir()
29
    {
30
        return $this->getProjectDir().'/var/cache/'.$this->environment;
31
    }
32
33
    /**
34
     * {@inheritdoc}
35
     */
36
    public function getLogDir()
37
    {
38
        return $this->getProjectDir().'/var/log';
39
    }
40
41
    /**
42
     * {@inheritdoc}
43
     */
44
    public function registerBundles()
45
    {
46
        $contents = require $this->getProjectDir().'/config/bundles.php';
47
48
        foreach ($contents as $class => $envs) {
49
            if (isset($envs['all']) || isset($envs[$this->environment])) {
50
                yield new $class();
51
            }
52
        }
53
    }
54
55
    /**
56
     * {@inheritdoc}
57
     */
58
    protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader)
59
    {
60
        $container->setParameter('container.autowiring.strict_mode', true);
61
        $container->setParameter('container.dumper.inline_class_loader', true);
62
        $confDir = $this->getProjectDir().'/config';
63
        $loader->load($confDir.'/packages/*'.self::CONFIG_EXTS, 'glob');
64
65 View Code Duplication
        if (is_dir($confDir.'/packages/'.$this->environment)) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
66
            $loader->load($confDir.'/packages/'.$this->environment.'/**/*'.self::CONFIG_EXTS, 'glob');
67
        }
68
69
        $loader->load($confDir.'/services'.self::CONFIG_EXTS, 'glob');
70
        $loader->load($confDir.'/services_'.$this->environment.self::CONFIG_EXTS, 'glob');
71
    }
72
73
    /**
74
     * {@inheritdoc}
75
     */
76
    protected function configureRoutes(RouteCollectionBuilder $routes)
77
    {
78
        $confDir = $this->getProjectDir().'/config';
79
80
        if (is_dir($confDir.'/routes/')) {
81
            $routes->import($confDir.'/routes/*'.self::CONFIG_EXTS, '/', 'glob');
82
        }
83
84 View Code Duplication
        if (is_dir($confDir.'/routes/'.$this->environment)) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
85
            $routes->import($confDir.'/routes/'.$this->environment.'/**/*'.self::CONFIG_EXTS, '/', 'glob');
86
        }
87
88
        $routes->import($confDir.'/routes'.self::CONFIG_EXTS, '/', 'glob');
89
    }
90
}
91