AppKernel::getCacheDir()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
declare(strict_types = 1);
3
4
use \Symfony\Component\Dotenv;
5
use \Symfony\Component\HttpKernel\Kernel;
6
use \Symfony\Component\Config\Loader\LoaderInterface;
7
8
class AppKernel extends Kernel
9
{
10
    public function __construct()
11
    {
12
        $env = getenv('APP_ENV') ?: 'prod';
13
        $debug = filter_var(getenv('APP_DEBUG'), FILTER_VALIDATE_BOOLEAN);
14
15
        if ($debug === true) {
16
            \Symfony\Component\Debug\Debug::enable();
17
        }
18
19
        parent::__construct($env, $debug);
20
    }
21
22
    public function registerBundles(): array
23
    {
24
        $bundles = [
25
            new \Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
26
            new \Symfony\Bundle\AsseticBundle\AsseticBundle(),
27
            new \Symfony\Bundle\MonologBundle\MonologBundle(),
28
            new \Symfony\Bundle\TwigBundle\TwigBundle(),
29
            new \PommProject\PommBundle\PommBundle(),
30
            new \AppBundle\AppBundle(),
31
        ];
32
33
        if ($this->getEnvironment() === 'dev') {
34
            $bundles[] = new \Symfony\Bundle\DebugBundle\DebugBundle();
35
            $bundles[] = new \Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
36
        }
37
38
        return $bundles;
39
    }
40
41
    public function getRootDir(): string
42
    {
43
        return __DIR__;
44
    }
45
46
    public function getCacheDir(): string
47
    {
48
        return __DIR__ . '/../var/cache/' . $this->getEnvironment();
49
    }
50
51
    public function getLogDir(): string
52
    {
53
        return __DIR__ . '/../var/logs/' . $this->getEnvironment();
54
    }
55
56
    public function registerContainerConfiguration(LoaderInterface $loader)
57
    {
58
        $loader->load(__DIR__ . '/config/config_' . $this->getEnvironment() . '.yml');
59
    }
60
}
61