|
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\IdentityAccess\Infrastructure\Symfony; |
|
14
|
|
|
|
|
15
|
|
|
use BenGorUser\UserBundle\BenGorUserBundle; |
|
16
|
|
|
use Doctrine\Bundle\DoctrineBundle\DoctrineBundle; |
|
17
|
|
|
use Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle; |
|
18
|
|
|
use Lexik\Bundle\JWTAuthenticationBundle\LexikJWTAuthenticationBundle; |
|
19
|
|
|
use Sensio\Bundle\DistributionBundle\SensioDistributionBundle; |
|
20
|
|
|
use SimpleBus\SymfonyBridge\SimpleBusCommandBusBundle; |
|
21
|
|
|
use SimpleBus\SymfonyBridge\SimpleBusEventBusBundle; |
|
22
|
|
|
use Symfony\Bundle\DebugBundle\DebugBundle; |
|
23
|
|
|
use Symfony\Bundle\FrameworkBundle\FrameworkBundle; |
|
24
|
|
|
use Symfony\Bundle\MonologBundle\MonologBundle; |
|
25
|
|
|
use Symfony\Bundle\SecurityBundle\SecurityBundle; |
|
26
|
|
|
use Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle; |
|
27
|
|
|
use Symfony\Bundle\TwigBundle\TwigBundle; |
|
28
|
|
|
use Symfony\Bundle\WebProfilerBundle\WebProfilerBundle; |
|
29
|
|
|
use Symfony\Component\Config\Loader\LoaderInterface; |
|
30
|
|
|
use Symfony\Component\HttpKernel\Kernel; |
|
31
|
|
|
|
|
32
|
|
|
class AppKernel extends Kernel |
|
33
|
|
|
{ |
|
34
|
|
|
public function registerBundles() |
|
35
|
|
|
{ |
|
36
|
|
|
$bundles = [ |
|
37
|
|
|
new DoctrineBundle(), |
|
38
|
|
|
new DoctrineMigrationsBundle(), |
|
39
|
|
|
new FrameworkBundle(), |
|
40
|
|
|
new LexikJWTAuthenticationBundle(), |
|
41
|
|
|
new MonologBundle(), |
|
42
|
|
|
new SecurityBundle(), |
|
43
|
|
|
new SimpleBusCommandBusBundle(), |
|
44
|
|
|
new SimpleBusEventBusBundle(), |
|
45
|
|
|
new SwiftmailerBundle(), |
|
46
|
|
|
new TwigBundle(), |
|
47
|
|
|
|
|
48
|
|
|
new \BenGorUser\TwigBridgeBundle\TwigBridgeBundle(), |
|
49
|
|
|
new \BenGorUser\SymfonyRoutingBridgeBundle\SymfonyRoutingBridgeBundle(), |
|
50
|
|
|
new \BenGorUser\SymfonySecurityBridgeBundle\SymfonySecurityBridgeBundle(), |
|
51
|
|
|
new \BenGorUser\SwiftMailerBridgeBundle\SwiftMailerBridgeBundle(), |
|
52
|
|
|
new \BenGorUser\DoctrineORMBridgeBundle\DoctrineORMBridgeBundle(), |
|
53
|
|
|
new \BenGorUser\SimpleBusBridgeBundle\SimpleBusBridgeBundle(), |
|
54
|
|
|
new \BenGorUser\SimpleBusBridgeBundle\SimpleBusDoctrineORMBridgeBundle(), |
|
55
|
|
|
|
|
56
|
|
|
|
|
57
|
|
|
new BenGorUserBundle(), |
|
58
|
|
|
]; |
|
59
|
|
|
|
|
60
|
|
View Code Duplication |
if (in_array($this->getEnvironment(), ['dev', 'test'], true)) { |
|
|
|
|
|
|
61
|
|
|
$bundles[] = new DebugBundle(); |
|
62
|
|
|
$bundles[] = new SensioDistributionBundle(); |
|
63
|
|
|
$bundles[] = new WebProfilerBundle(); |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
|
|
return $bundles; |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
|
|
public function getRootDir() |
|
70
|
|
|
{ |
|
71
|
|
|
return __DIR__; |
|
72
|
|
|
} |
|
73
|
|
|
|
|
74
|
|
|
public function getCacheDir() |
|
75
|
|
|
{ |
|
76
|
|
|
return dirname(__DIR__) . '/../../var/cache/' . $this->getEnvironment(); |
|
77
|
|
|
} |
|
78
|
|
|
|
|
79
|
|
|
public function getLogDir() |
|
80
|
|
|
{ |
|
81
|
|
|
return dirname(__DIR__) . '/../../var/logs'; |
|
82
|
|
|
} |
|
83
|
|
|
|
|
84
|
|
|
public function registerContainerConfiguration(LoaderInterface $loader) |
|
85
|
|
|
{ |
|
86
|
|
|
$loader->load($this->getRootDir() . '/config/config_' . $this->getEnvironment() . '.yml'); |
|
87
|
|
|
} |
|
88
|
|
|
} |
|
89
|
|
|
|
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.