Conditions | 3 |
Paths | 4 |
Total Lines | 16 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 3 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
9 | 3 | protected function convertExceptionToArray($exception) |
|
10 | { |
||
11 | $payload = [ |
||
12 | 3 | 'status' => Status::ERROR, |
|
13 | 3 | 'message' => $exception->getMessage(), |
|
14 | 3 | 'code' => $exception->getCode(), |
|
15 | ]; |
||
16 | |||
17 | 3 | if (YII_DEBUG) { |
|
18 | 3 | $payload['data']['trace'] = explode("\n", $exception->getTraceAsString()); |
|
19 | } |
||
20 | 3 | if (($prev = $exception->getPrevious()) !== null) { |
|
21 | 1 | $payload['previous'] = $this->convertExceptionToArray($prev); |
|
22 | } |
||
23 | |||
24 | 3 | return $payload; |
|
25 | } |
||
27 |