Completed
Pull Request — master (#5)
by Alex
09:21 queued 02:29
created

AppKernel::isSymfony3()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
/*
4
* This file is part of the OrbitaleCmsBundle package.
5
*
6
* (c) Alexandre Rock Ancelet <[email protected]>
7
*
8
* For the full copyright and license information, please view the LICENSE
9
* file that was distributed with this source code.
10
*/
11
12
use Symfony\Component\HttpKernel\Kernel;
13
use Symfony\Component\Config\Loader\LoaderInterface;
14
use Symfony\Component\DependencyInjection\ContainerBuilder;
15
16
class AppKernel extends Kernel
17
{
18
    public function registerBundles()
19
    {
20
        return array(
21
            new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
22
            new Symfony\Bundle\SecurityBundle\SecurityBundle(),
23
            new Symfony\Bundle\TwigBundle\TwigBundle(),
24
            new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
25
            new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
26
27
            new Orbitale\Bundle\CmsBundle\OrbitaleCmsBundle(),
28
        );
29
    }
30
31
    public function registerContainerConfiguration(LoaderInterface $loader)
32
    {
33
        $loader->load(__DIR__.'/config/config_'.$this->getEnvironment().'.yml');
34
35
        if ($this->isSymfony3()) {
36
            $loader->load(function (ContainerBuilder $container) {
37
                $container->loadFromExtension('framework', array(
38
                    'assets' => null,
39
                ));
40
            });
41
        }
42
    }
43
44
    /**
45
     * @return string
46
     */
47
    public function getCacheDir()
48
    {
49
        return __DIR__.'/../../../build/cache/'.$this->getEnvironment();
50
    }
51
52
    /**
53
     * @return string
54
     */
55
    public function getLogDir()
56
    {
57
        return __DIR__.'/../../../build/kernel_logs/'.$this->getEnvironment();
58
    }
59
60
    /**
61
     * @return bool
62
     */
63
    private function isSymfony3()
64
    {
65
        return 3 === Kernel::MAJOR_VERSION;
66
    }
67
}
68