Completed
Pull Request — master (#366)
by Beñat
05:52 queued 01:06
created

AppKernel::getRootDir()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Importance

Changes 0
Metric Value
dl 4
loc 4
c 0
b 0
f 0
rs 10
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\TwigBundle\TwigBundle;
34
use Symfony\Bundle\WebProfilerBundle\WebProfilerBundle;
35
use Symfony\Bundle\WebServerBundle\WebServerBundle;
36
use Symfony\Component\Config\Loader\LoaderInterface;
37
use Symfony\Component\HttpKernel\Kernel;
38
use Warezgibzzz\QueryBusBundle\WarezgibzzzQueryBusBundle;
39
40 View Code Duplication
class AppKernel extends Kernel
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in 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...
41
{
42
    public function registerBundles() : array
43
    {
44
        $bundles = [
45
            new AppBundle(),
46
            new DoctrineBundle(),
47
            new FrameworkBundle(),
48
            new HttplugBundle(),
49
            new MonologBundle(),
50
            new NelmioCorsBundle(),
51
            new OldSoundRabbitMqBundle(),
52
            new ONGRElasticsearchBundle(),
53
            new SecurityBundle(),
54
            new SimpleBusCommandBusBundle(),
55
            new SimpleBusEventBusBundle(),
56
            new SncRedisBundle(),
57
            new SwiftmailerBundle(),
58
            new TwigBundle(),
59
            new WarezgibzzzQueryBusBundle(),
60
        ];
61
62
        if (in_array($this->getEnvironment(), ['dev', 'test'], true)) {
63
            $bundles[] = new DebugBundle();
64
            $bundles[] = new WebProfilerBundle();
65
66
            if ('dev' === $this->getEnvironment()) {
67
                $bundles[] = new DoctrineFixturesBundle();
68
                $bundles[] = new WebServerBundle();
69
            }
70
        }
71
72
        return $bundles;
73
    }
74
75
    public function getRootDir() : string
76
    {
77
        return __DIR__;
78
    }
79
80
    public function getCacheDir() : string
81
    {
82
        return dirname(__DIR__) . '/../../../../../var/cache/' . $this->getEnvironment();
83
    }
84
85
    public function getLogDir() : string
86
    {
87
        return dirname(__DIR__) . '/../../../../../var/logs';
88
    }
89
90
    public function registerContainerConfiguration(LoaderInterface $loader) : void
91
    {
92
        $loader->load($this->getRootDir() . '/config/config_' . $this->getEnvironment() . '.yml');
93
    }
94
95
    protected function getContainerBaseClass() : string
96
    {
97
        if ('test' === $this->environment) {
98
            return MockerContainer::class;
99
        }
100
101
        return parent::getContainerBaseClass();
102
    }
103
}
104