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

KernelTrait   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
dl 0
loc 15
rs 10
c 1
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A loadKernel() 0 9 2
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
}