FallbackController::fallback()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 11
rs 9.9
c 0
b 0
f 0
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: polidog
5
 * Date: 2016/07/16.
6
 */
7
8
namespace Polidog\LaravelBundle\Controller;
9
10
use Polidog\LaravelBundle\Environment;
11
use Polidog\LaravelBundle\LaravelKernel;
12
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
13
use Illuminate\Http\Request as IlluminateRequest;
14
15
/**
16
 * @Route(service="polidog_laravel.controller.fallback")
17
 */
18
class FallbackController
19
{
20
    protected $env;
21
22
    protected $laravelKernel;
23
24
    public function __construct(Environment $env, LaravelKernel $laravelKernel)
25
    {
26
        $this->env = $env;
27
        $this->laravelKernel = $laravelKernel;
28
    }
29
30
    public function fallback()
31
    {
32
        // env
33
        $this->env->put();
34
35
        $request = IlluminateRequest::capture();
36
        $response = $this->laravelKernel->handle($request);
37
        $this->laravelKernel->terminate($request, $response);
38
39
        return $response;
40
    }
41
}
42