ErrorController::display()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 17
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 10
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 17
ccs 10
cts 10
cp 1
rs 9.9666
c 0
b 0
f 0
cc 2
nc 2
nop 2
crap 2
1
<?php namespace Distilleries\Expendable\Http\Controllers\Backend\Base;
2
3
use \Exception;
4
5
class ErrorController extends BaseController {
6
7
8
    protected $layout = 'expendable::admin.layout.error';
9 2
    public function display(Exception $exception, $code)
10
    {
11 2
        $class = ($code == 404) ? 'page-404' : 'page-500';
12
13 2
        $content = view('expendable::admin.errors.default', [
14 2
            'code'    => $code,
15 2
            'class'    => $class,
16 2
            'message' => $exception->getMessage(),
17
        ]);
18
19
20 2
        $this->layoutManager->add([
21 2
            'class_layout'=>$class.'-full-page',
22 2
            'content'=>$content,
23
        ]);
24
25 2
        return response()->make($this->layoutManager->render(), $code);
26
    }
27
28
    // ------------------------------------------------------------------------------------------------
29
    // ------------------------------------------------------------------------------------------------
30
    // ------------------------------------------------------------------------------------------------
31
32 2
    protected function initStaticPart()
33
    {
34 2
        $this->layoutManager->initStaticPart();
35
    }
36
}