Passed
Push — master ( 4109cd...3773bc )
by Dev
13:23
created

KernelTrait::loadKernel()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

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