Completed
Push — master ( 402c8e...a49823 )
by Philip
22:11
created

Kernel::getLogDir()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
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
class Kernel extends BaseKernel
12
{
13
    use MicroKernelTrait;
14
15
    const CONFIG_EXTS = '.{php,xml,yaml,yml}';
16
17
    public function getCacheDir()
18
    {
19
        return $this->getProjectDir() . '/var/cache/' . $this->environment;
20
    }
21
22
    public function getLogDir()
23
    {
24
        return $this->getProjectDir() . '/var/log';
25
    }
26
27
    public function registerBundles()
28
    {
29
        $contents = require $this->getProjectDir() . '/config/bundles.php';
30
        foreach ($contents as $class => $envs) {
31
            if (isset($envs['all']) || isset($envs[$this->environment])) {
32
                yield new $class();
33
            }
34
        }
35
    }
36
37
    protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader)
38
    {
39
        // Feel free to remove the "container.autowiring.strict_mode" parameter
40
        // if you are using symfony/dependency-injection 4.0+ as it's the default behavior
41
        $container->setParameter('container.autowiring.strict_mode', true);
42
        $container->setParameter('container.dumper.inline_class_loader', true);
43
        $confDir = $this->getProjectDir() . '/config';
44
45
        $loader->load($confDir . '/{packages}/*' . self::CONFIG_EXTS, 'glob');
46
        $loader->load($confDir . '/{packages}/' . $this->environment . '/**/*' . self::CONFIG_EXTS, 'glob');
47
        $loader->load($confDir . '/{services}' . self::CONFIG_EXTS, 'glob');
48
        $loader->load($confDir . '/{services}_' . $this->environment . self::CONFIG_EXTS, 'glob');
49
    }
50
51
    protected function configureRoutes(RouteCollectionBuilder $routes)
52
    {
53
        $confDir = $this->getProjectDir() . '/config';
54
55
        $routes->import($confDir . '/{routes}/*' . self::CONFIG_EXTS, '/', 'glob');
56
        $routes->import($confDir . '/{routes}/' . $this->environment . '/**/*' . self::CONFIG_EXTS, '/', 'glob');
57
        $routes->import($confDir . '/{routes}' . self::CONFIG_EXTS, '/', 'glob');
58
    }
59
}
60