Test Setup Failed
Pull Request — master (#487)
by Andrew
05:19
created

AppKernel   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 104
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 7
eloc 55
dl 0
loc 104
rs 10
c 0
b 0
f 0
1
<?php
2
3
use Symfony\Component\HttpKernel\Kernel;
4
use Symfony\Component\Config\Loader\LoaderInterface;
5
6
/**
7
 * Class AppKernel
8
 */
9
class AppKernel extends Kernel
10
{
11
    /**
12
     * Register bundles
13
     *
14
     * @return array|\Symfony\Component\HttpKernel\Bundle\BundleInterface[]
15
     */
16
    public function registerBundles()
17
    {
18
        $bundles = array(
19
            new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
20
            new Symfony\Bundle\SecurityBundle\SecurityBundle(),
21
            new Symfony\Bundle\TwigBundle\TwigBundle(),
22
            new Symfony\Bundle\MonologBundle\MonologBundle(),
23
            new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
24
            new Symfony\Bundle\AsseticBundle\AsseticBundle(),
25
            new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
26
27
            new JMS\AopBundle\JMSAopBundle(),
28
            new JMS\SecurityExtraBundle\JMSSecurityExtraBundle(),
29
            new JMS\DiExtraBundle\JMSDiExtraBundle($this),
30
            new JMS\I18nRoutingBundle\JMSI18nRoutingBundle(),
31
32
            new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
33
            new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle(),
34
            new Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle(),
35
            new Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(),
36
37
            new FOS\UserBundle\FOSUserBundle(),
38
39
            new Knp\Bundle\MenuBundle\KnpMenuBundle(),
40
41
            new Sonata\IntlBundle\SonataIntlBundle(),
42
            new Sonata\BlockBundle\SonataBlockBundle(),
43
            new Sonata\AdminBundle\SonataAdminBundle(),
44
            new Sonata\CoreBundle\SonataCoreBundle(),
45
            new Sonata\DoctrineORMAdminBundle\SonataDoctrineORMAdminBundle(),
46
47
            new Stfalcon\Bundle\EventBundle\StfalconEventBundle(),
48
            new Stfalcon\Bundle\SponsorBundle\StfalconSponsorBundle(),
49
50
            new Application\Bundle\DefaultBundle\ApplicationDefaultBundle(),
51
            new Application\Bundle\UserBundle\ApplicationUserBundle(),
52
53
            new Vich\UploaderBundle\VichUploaderBundle(),
54
            new Ornicar\GravatarBundle\OrnicarGravatarBundle(),
55
56
            new TFox\MpdfPortBundle\TFoxMpdfPortBundle(),
57
            new Sensio\Bundle\BuzzBundle\SensioBuzzBundle(),
58
59
            new Accord\MandrillSwiftMailerBundle\AccordMandrillSwiftMailerBundle(),
60
61
            new Lexik\Bundle\TranslationBundle\LexikTranslationBundle(),
62
            new Ibrows\SonataTranslationBundle\IbrowsSonataTranslationBundle(),
63
            new A2lix\TranslationFormBundle\A2lixTranslationFormBundle(),
64
65
            new FOS\JsRoutingBundle\FOSJsRoutingBundle(),
66
            new HWI\Bundle\OAuthBundle\HWIOAuthBundle(),
67
68
            new SunCat\MobileDetectBundle\MobileDetectBundle(),
69
70
            new Liip\ImagineBundle\LiipImagineBundle(),
71
            new Maxmind\Bundle\GeoipBundle\MaxmindGeoipBundle(),
72
73
            new CMEN\GoogleChartsBundle\CMENGoogleChartsBundle(),
74
        );
75
76
        if (in_array($this->getEnvironment(), ['prod', 'stag'], true)) {
77
            $bundles[] = new Sentry\SentryBundle\SentryBundle();
78
        }
79
80
        if (in_array($this->getEnvironment(), array('dev', 'test'))) {
81
            $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
82
            $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
83
            $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
84
        }
85
        if ($this->getEnvironment() === 'test') {
86
            $bundles[] = new Liip\FunctionalTestBundle\LiipFunctionalTestBundle();
87
        }
88
89
        return $bundles;
90
    }
91
92
    /**
93
     * Register container configuration
94
     *
95
     * @param LoaderInterface $loader
96
     */
97
    public function registerContainerConfiguration(LoaderInterface $loader)
98
    {
99
        $loader->load($this->getRootDir().'/config/config_'.$this->getEnvironment().'.yml');
100
    }
101
102
103
    /**
104
     * @return string
105
     */
106
    protected function getContainerBaseClass()
107
    {
108
        if ('test' === $this->getEnvironment()) {
109
            return '\PSS\SymfonyMockerContainer\DependencyInjection\MockerContainer';
110
        }
111
112
        return parent::getContainerBaseClass();
113
    }
114
}
115