KernelTrait::loadKernel()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 1 Features 0
Metric Value
cc 2
eloc 4
nc 2
nop 1
dl 0
loc 8
rs 10
c 2
b 1
f 0
1
<?php
2
3
namespace PiedWeb\CMSBundle\Utils;
4
5
use Symfony\Component\HttpKernel\KernelInterface;
6
7
trait KernelTrait
8
{
9
    public static $appKernel;
10
    protected $kernel;
11
12
    public static function loadKernel(KernelInterface $kernel)
13
    {
14
        if (null === static::$appKernel) {
15
            $kernelClass = \get_class($kernel);
16
            static::$appKernel = new $kernelClass('dev', true);
17
            //static::$appKernel = clone $kernel;
18
            // NOTE: If we clone, it's take too much time in dev mod
19
            static::$appKernel->boot();
20
        }
21
    }
22
}
23