Conditions | 5 |
Paths | 12 |
Total Lines | 22 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Tests | 12 |
CRAP Score | 5.0729 |
Changes | 0 |
1 | <?php |
||
23 | 4 | public function __construct($message, $code = 500, $exception = null) |
|
24 | { |
||
25 | 4 | parent::__construct($message, $code); |
|
26 | |||
27 | 4 | if ($exception === null) { |
|
28 | $exception = $this; |
||
29 | } |
||
30 | |||
31 | 4 | if (!empty($message)) { |
|
32 | $message .= " "; |
||
33 | } |
||
34 | |||
35 | 4 | $this->errorMessage = get_class($exception) . " is thrown: " . $message . $exception->getFile() . "(" . $exception->getLine() . ")"; |
|
36 | 4 | $stacktraceList = explode("#", $exception->getTraceAsString()); |
|
37 | 4 | foreach ($stacktraceList as $stacktraceLine) { |
|
38 | 4 | if ($stacktraceLine === "") { |
|
39 | 4 | continue; |
|
40 | } |
||
41 | 4 | $this->errorMessage .= PHP_EOL; |
|
42 | 4 | $this->errorMessage .= "\t#" . trim($stacktraceLine); |
|
43 | } |
||
44 | 4 | } |
|
45 | |||
55 |