MockKernel::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 6
rs 9.4285
1
<?php
2
3
namespace PHPFastCGI\SpeedfonyBundle\Tests\Helper;
4
5
use Symfony\Component\Config\Loader\LoaderInterface;
6
use Symfony\Component\HttpFoundation\Request;
7
use Symfony\Component\HttpKernel\Kernel;
8
9
class MockKernel extends Kernel
10
{
11
    /**
12
     * @var callable
13
     */
14
    private $callback;
15
16
    /**
17
     * Constructor.
18
     * 
19
     * @param callable $callback
20
     */
21
    public function __construct($callback)
22
    {
23
        $this->callback = $callback;
24
25
        parent::__construct('dev', false);
26
    }
27
28
    /**
29
     * {@inheritdoc}
30
     */
31
    public function registerBundles()
32
    {
33
        return [];
34
    }
35
36
    /**
37
     * {@inheritdoc}
38
     */
39
    public function registerContainerConfiguration(LoaderInterface $loader)
40
    {
41
    }
42
43
    /**
44
     * {@inheritdoc}
45
     */
46
    public function handle(Request $request, $type = 1, $catch = true)
47
    {
48
        return call_user_func($this->callback, $request);
49
    }
50
}
51