Completed
Pull Request — master (#178)
by Beñat
03:05
created

AppKernel::getRootDir()   A

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
3
/*
4
 * This file is part of the Kreta package.
5
 *
6
 * (c) Beñat Espiña <[email protected]>
7
 * (c) Gorka Laucirica <[email protected]>
8
 *
9
 * For the full copyright and license information, please view the LICENSE
10
 * file that was distributed with this source code.
11
 */
12
13
namespace Kreta\TaskManager\Infrastructure\Symfony;
14
15
use Doctrine\Bundle\DoctrineBundle\DoctrineBundle;
16
use Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle;
17
use Kreta\TaskManager\Infrastructure\Symfony\Bundle\AppBundle;
18
use Overblog\GraphQLBundle\OverblogGraphQLBundle;
19
use Sensio\Bundle\DistributionBundle\SensioDistributionBundle;
20
use SimpleBus\SymfonyBridge\DoctrineOrmBridgeBundle;
21
use SimpleBus\SymfonyBridge\SimpleBusCommandBusBundle;
22
use SimpleBus\SymfonyBridge\SimpleBusEventBusBundle;
23
use Symfony\Bundle\DebugBundle\DebugBundle;
24
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
25
use Symfony\Bundle\MonologBundle\MonologBundle;
26
use Symfony\Bundle\SecurityBundle\SecurityBundle;
27
use Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle;
28
use Symfony\Bundle\TwigBundle\TwigBundle;
29
use Symfony\Bundle\WebProfilerBundle\WebProfilerBundle;
30
use Symfony\Component\Config\Loader\LoaderInterface;
31
use Symfony\Component\HttpKernel\Kernel;
32
33
class AppKernel extends Kernel
34
{
35
    public function registerBundles()
36
    {
37
        $bundles = [
38
            new AppBundle(),
39
            new DoctrineBundle(),
40
            new DoctrineMigrationsBundle(),
41
            new DoctrineOrmBridgeBundle(),
42
            new FrameworkBundle(),
43
            new OverblogGraphQLBundle(),
44
            new MonologBundle(),
45
            new SecurityBundle(),
46
            new SimpleBusCommandBusBundle(),
47
            new SimpleBusEventBusBundle(),
48
            new SwiftmailerBundle(),
49
            new TwigBundle(),
50
        ];
51
52
        if (in_array($this->getEnvironment(), ['dev', 'test'], true)) {
53
            $bundles[] = new DebugBundle();
54
            $bundles[] = new SensioDistributionBundle();
55
            $bundles[] = new WebProfilerBundle();
56
        }
57
58
        return $bundles;
59
    }
60
61
    public function getRootDir()
62
    {
63
        return __DIR__;
64
    }
65
66
    public function getCacheDir()
67
    {
68
        return dirname(__DIR__) . '/../../var/cache/' . $this->getEnvironment();
69
    }
70
71
    public function getLogDir()
72
    {
73
        return dirname(__DIR__) . '/../../var/logs';
74
    }
75
76
    public function registerContainerConfiguration(LoaderInterface $loader)
77
    {
78
        $loader->load($this->getRootDir() . '/config/config_' . $this->getEnvironment() . '.yml');
79
    }
80
}
81