Completed
Push — master ( a11004...3b70da )
by Tomáš
06:04
created

AppKernel::registerBundles()   B

Complexity

Conditions 3
Paths 4

Size

Total Lines 39
Code Lines 28

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 25
CRAP Score 3.0036

Importance

Changes 0
Metric Value
dl 0
loc 39
ccs 25
cts 27
cp 0.9259
rs 8.8571
c 0
b 0
f 0
cc 3
eloc 28
nc 4
nop 0
crap 3.0036
1
<?php
2
3
use Symfony\Component\HttpKernel\Kernel;
4
use Symfony\Component\Config\Loader\LoaderInterface;
5
6
class AppKernel extends Kernel
7
{
8 21
    public function registerBundles()
9
    {
10
        $bundles = array(
11 21
            new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
12 21
            new Symfony\Bundle\SecurityBundle\SecurityBundle(),
13 21
            new Symfony\Bundle\TwigBundle\TwigBundle(),
14 21
            new Symfony\Bundle\MonologBundle\MonologBundle(),
15 21
            new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
16 21
            new Symfony\Bundle\AsseticBundle\AsseticBundle(),
17 21
            new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
18 21
            new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
19
            // Additional bundles
20 21
            new FOS\RestBundle\FOSRestBundle(),
21 21
            new JMS\SerializerBundle\JMSSerializerBundle(),
22 21
            new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle(),
23 21
            new Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(),
24 21
            new \Tbbc\MoneyBundle\TbbcMoneyBundle(),
25
26
            // Webcookcms bundles, loaded via `bundles.php`
27 21
            new Webcook\Cms\SecurityBundle\WebcookCmsSecurityBundle(),
28 21
            new Webcook\Cms\CoreBundle\WebcookCmsCoreBundle(),
29 21
            new Webcook\Cms\I18nBundle\WebcookCmsI18nBundle(),
30
        );
31
32 21
        if (in_array($this->getEnvironment(), array('dev', 'test'))) {
33 21
            $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
34 21
            $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
35 21
            $bundles[] = new Liip\FunctionalTestBundle\LiipFunctionalTestBundle();
36 21
            $bundles[] = new Nelmio\ApiDocBundle\NelmioApiDocBundle();
37
        }
38
39 21
        $bundlePath = __DIR__.'/../../../../../../../../tests/bundles.php';
40 21
        if (file_exists($bundlePath)) {
41
            $sBundles = require $bundlePath;
42
            $bundles = array_merge($bundles, $sBundles);
43
        }
44
45 21
        return $bundles;
46
    }
47
48 1
    public function registerContainerConfiguration(LoaderInterface $loader)
49
    {
50 1
        $loader->load(__DIR__.'/config/config_'.$this->getEnvironment().'.yml');
51
52 1
        $testConfigPath = __DIR__.'/../../../../../../../../tests/config.yml';
53 1
        if (file_exists($testConfigPath)) {
54
            $loader->load($testConfigPath);
55
        } else {
56 1
            $loader->load(__DIR__.'/../../../../../tests/config.yml');
57
        }
58 1
    }
59
}
60