AppKernel   C
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 121
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 54

Importance

Changes 0
Metric Value
wmc 8
lcom 1
cbo 54
dl 0
loc 121
rs 5
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A registerBundles() 0 63 1
A registerContainerConfiguration() 0 4 1
A getCacheDir() 0 4 1
A getLogDir() 0 4 1
A getTestBundles() 0 20 4
1
<?php
0 ignored issues
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 8 and the first side effect is on line 6.

The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.

The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.

To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.

Loading history...
2
3
use Symfony\Component\Config\Loader\LoaderInterface;
4
use Symfony\Component\HttpKernel\Kernel;
5
6
require_once __DIR__.'/autoload.php';
7
8
class AppKernel extends Kernel
0 ignored issues
show
introduced by
Missing class doc comment
Loading history...
9
{
10
    /**
11
     * @return array
12
     */
13
    public function registerBundles()
14
    {
15
        return array_merge(
16
            [
17
                new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
18
                new Symfony\Bundle\SecurityBundle\SecurityBundle(),
19
                new Symfony\Bundle\TwigBundle\TwigBundle(),
20
                new Symfony\Bundle\MonologBundle\MonologBundle(),
21
                new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
22
                new Symfony\Bundle\AsseticBundle\AsseticBundle(),
23
                new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
24
                new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
25
                new Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(),
26
27
                new A2lix\TranslationFormBundle\A2lixTranslationFormBundle(),
28
                new Bazinga\Bundle\JsTranslationBundle\BazingaJsTranslationBundle(),
29
                new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle(),
30
                new Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle(),
31
                new FOS\UserBundle\FOSUserBundle(),
32
                new FOS\JsRoutingBundle\FOSJsRoutingBundle(),
33
                new JMS\SerializerBundle\JMSSerializerBundle(),
34
                new Knp\DoctrineBehaviors\Bundle\DoctrineBehaviorsBundle(),
35
                new Knp\Bundle\MenuBundle\KnpMenuBundle(),
36
                new Liip\ImagineBundle\LiipImagineBundle(),
37
                new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle(),
38
                new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle(),
39
                new Snc\RedisBundle\SncRedisBundle(),
40
                new Troopers\AsseticInjectorBundle\TroopersAsseticInjectorBundle(),
41
                new Troopers\AlertifyBundle\TroopersAlertifyBundle(),
42
43
            //Victoire bundles
44
            new Victoire\Bundle\AnalyticsBundle\VictoireAnalyticsBundle(),
45
            new Victoire\Bundle\CoreBundle\VictoireCoreBundle(),
46
            new Victoire\Bundle\CriteriaBundle\VictoireCriteriaBundle(),
47
            new Victoire\Bundle\BlogBundle\VictoireBlogBundle(),
48
            new Victoire\Bundle\BusinessEntityBundle\VictoireBusinessEntityBundle(),
49
            new Victoire\Bundle\BusinessPageBundle\VictoireBusinessPageBundle(),
50
            new Victoire\Bundle\FilterBundle\VictoireFilterBundle(),
51
            new Victoire\Bundle\I18nBundle\VictoireI18nBundle(),
52
            new Victoire\Bundle\FormBundle\VictoireFormBundle(),
53
            new Victoire\Bundle\PageBundle\VictoirePageBundle(),
54
            new Victoire\Bundle\QueryBundle\VictoireQueryBundle(),
55
            new Victoire\Bundle\MediaBundle\VictoireMediaBundle(),
56
            new Victoire\Bundle\SeoBundle\VictoireSeoBundle(),
57
            new Victoire\Bundle\SitemapBundle\VictoireSitemapBundle(),
58
            new Victoire\Bundle\TemplateBundle\VictoireTemplateBundle(),
59
            new Victoire\Bundle\TwigBundle\VictoireTwigBundle(),
60
            new Victoire\Bundle\UIBundle\VictoireUIBundle(),
61
            new Victoire\Bundle\UserBundle\VictoireUserBundle(),
62
            new Victoire\Bundle\ViewReferenceBundle\ViewReferenceBundle(),
63
            new Victoire\Bundle\WidgetBundle\VictoireWidgetBundle(),
64
            new Victoire\Bundle\WidgetMapBundle\VictoireWidgetMapBundle(),
65
new Victoire\Bundle\ORMBusinessEntityBundle\VictoireORMBusinessEntityBundle(),
66
            new Victoire\Bundle\APIBusinessEntityBundle\VictoireAPIBusinessEntityBundle(),            //Victoire minmaltest bundles
67
            new Victoire\Widget\ForceBundle\VictoireWidgetForceBundle(),
68
            new Victoire\Widget\LightSaberBundle\VictoireWidgetLightSaberBundle(),
69
            new Victoire\Widget\ButtonBundle\VictoireWidgetButtonBundle(),
70
            new Victoire\Widget\TextBundle\VictoireWidgetTextBundle(),
71
            new Acme\AppBundle\AcmeAppBundle(),
72
        ],
73
            $this->getTestBundles()
74
        );
75
    }
76
77
    /**
78
     * @param LoaderInterface $loader
79
     */
80
    public function registerContainerConfiguration(LoaderInterface $loader)
81
    {
82
        $loader->load(__DIR__.'/config/config_'.$this->getEnvironment().'.yml');
83
    }
84
85
    /**
86
     * @return string
87
     */
88
    public function getCacheDir()
89
    {
90
        return sys_get_temp_dir().'/Victoire/cache/'.$this->environment;
91
    }
92
93
    /**
94
     * @return string
95
     */
96
    public function getLogDir()
97
    {
98
        return sys_get_temp_dir().'/Victoire/logs/'.$this->environment;
99
    }
100
101
    /**
102
     * Include Tests Bundles defined in Bundles.php file.
103
     *
104
     * @throws ErrorException
105
     *
106
     * @return array
107
     */
108
    private function getTestBundles()
109
    {
110
        $bundlesFile = __DIR__.'/../../../../../../Tests/Bundles.php';
111
112
        if (file_exists($bundlesFile)) {
113
            include $bundlesFile;
114
115
            if (!isset($victoireTestBundles)) {
0 ignored issues
show
Bug introduced by
The variable $victoireTestBundles seems to never exist, and therefore isset should always return false. Did you maybe rename this variable?

This check looks for calls to isset(...) or empty() on variables that are yet undefined. These calls will always produce the same result and can be removed.

This is most likely caused by the renaming of a variable or the removal of a function/method parameter.

Loading history...
116
                throw new \ErrorException(sprintf('$victoireTestBundles is not defined in Bundles.php file'));
117
            }
118
119
            if (!is_array($victoireTestBundles)) {
120
                throw new \ErrorException(sprintf('$victoireTestBundles defined in Bundles.php must be an array'));
121
            }
122
123
            return $victoireTestBundles;
124
        }
125
126
        return [];
127
    }
128
}
129