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