Completed
Pull Request — master (#366)
by Beñat
04:48
created

AppKernel::getLogDir()   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
declare(strict_types=1);
14
15
namespace Kreta\Notifier\Infrastructure\Symfony\Framework;
16
17
use Doctrine\Bundle\DoctrineBundle\DoctrineBundle;
18
use Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle;
19
use Http\HttplugBundle\HttplugBundle;
20
use Kreta\Notifier\Infrastructure\Projection\ReadModel\Inbox\Elasticsearch\AppBundle;
21
use Nelmio\CorsBundle\NelmioCorsBundle;
22
use OldSound\RabbitMqBundle\OldSoundRabbitMqBundle;
23
use ONGR\ElasticsearchBundle\ONGRElasticsearchBundle;
24
use PSS\SymfonyMockerContainer\DependencyInjection\MockerContainer;
25
use SimpleBus\SymfonyBridge\SimpleBusCommandBusBundle;
26
use SimpleBus\SymfonyBridge\SimpleBusEventBusBundle;
27
use Snc\RedisBundle\SncRedisBundle;
28
use Symfony\Bundle\DebugBundle\DebugBundle;
29
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
30
use Symfony\Bundle\MonologBundle\MonologBundle;
31
use Symfony\Bundle\SecurityBundle\SecurityBundle;
32
use Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle;
33
use Symfony\Bundle\WebServerBundle\WebServerBundle;
34
use Symfony\Component\Config\Loader\LoaderInterface;
35
use Symfony\Component\HttpKernel\Kernel;
36
use Warezgibzzz\QueryBusBundle\WarezgibzzzQueryBusBundle;
37
38
class AppKernel extends Kernel
39
{
40
    public function registerBundles() : array
41
    {
42
        $bundles = [
43
            new AppBundle(),
44
            new DoctrineBundle(),
45
            new FrameworkBundle(),
46
            new HttplugBundle(),
47
            new MonologBundle(),
48
            new NelmioCorsBundle(),
49
            new OldSoundRabbitMqBundle(),
50
            new ONGRElasticsearchBundle(),
51
            new SecurityBundle(),
52
            new SimpleBusCommandBusBundle(),
53
            new SimpleBusEventBusBundle(),
54
            new SncRedisBundle(),
55
            new SwiftmailerBundle(),
56
            new WarezgibzzzQueryBusBundle(),
57
        ];
58
59
        if (in_array($this->getEnvironment(), ['dev', 'test'], true)) {
60
            $bundles[] = new DebugBundle();
61
62
            if ('dev' === $this->getEnvironment()) {
63
                $bundles[] = new DoctrineFixturesBundle();
64
                $bundles[] = new WebServerBundle();
65
            }
66
        }
67
68
        return $bundles;
69
    }
70
71
    public function getRootDir() : string
72
    {
73
        return __DIR__;
74
    }
75
76
    public function getCacheDir() : string
77
    {
78
        return dirname(__DIR__) . '/../../../../../var/cache/' . $this->getEnvironment();
79
    }
80
81
    public function getLogDir() : string
82
    {
83
        return dirname(__DIR__) . '/../../../../../var/logs';
84
    }
85
86
    public function registerContainerConfiguration(LoaderInterface $loader) : void
87
    {
88
        $loader->load($this->getRootDir() . '/config/config_' . $this->getEnvironment() . '.yml');
89
    }
90
91
    protected function getContainerBaseClass() : string
92
    {
93
        if ('test' === $this->environment) {
94
            return MockerContainer::class;
95
        }
96
97
        return parent::getContainerBaseClass();
98
    }
99
}
100