Completed
Push — master ( 9efb49...7ad915 )
by Park Jong-Hun
03:23
created

Html   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 3
Bugs 0 Features 1
Metric Value
wmc 4
c 3
b 0
f 1
lcom 1
cbo 0
dl 0
loc 32
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A buildView() 0 5 1
A report() 0 5 1
A setReportVariables() 0 7 1
1
<?php
2
3
namespace App\ErrorReporter;
4
5
use Core\ErrorReporterInterface;
6
use \Exception;
7
8
class Html implements ErrorReporterInterface
9
{
10
    /**
11
         * @var View
12
         */
13
    private $view;
14
15
    public function __construct($settings = [])
16
    {
17
        $this->buildView($settings);
18
    }
19
20
    private function buildView($settings)
21
    {
22
        $this->view = new $settings['view']($settings);
23
        $this->view->file($settings['file']);
24
    }
25
26
    public function report($exception)
27
    {
28
        $this->setReportVariables($exception);
29
        echo $this->view->render();
30
    }
31
32
    private function setReportVariables($exception)
33
    {
34
        $this->view->set('message', $exception->getMessage());
35
        $this->view->set('file', $exception->getFile());
36
        $this->view->set('line', $exception->getLine());
37
        $this->view->set('traces', $exception->getTrace());
38
    }
39
}
40