| Conditions | 3 |
| Paths | 4 |
| Total Lines | 21 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 3.576 |
| 1 | <?php |
||
| 22 | 4 | public function transformException(\Exception $exception) |
|
| 23 | { |
||
| 24 | $data = array( |
||
| 25 | 4 | 'code' => sprintf('%d', $exception->getCode()), |
|
| 26 | 4 | 'title' => $exception->getMessage() |
|
| 27 | 4 | ); |
|
| 28 | |||
| 29 | 4 | if ($exception instanceof HttpException) { |
|
| 30 | 2 | $data['status'] = (string) $exception->getStatusCode(); |
|
| 31 | 2 | } |
|
| 32 | |||
| 33 | 4 | if ($this->debug) { |
|
| 34 | $data['meta'] = array( |
||
| 35 | 'trace' => $exception->getTraceAsString(), |
||
| 36 | 'file' => $exception->getFile(), |
||
| 37 | 'line' => $exception->getLine() |
||
| 38 | ); |
||
| 39 | } |
||
| 40 | |||
| 41 | 4 | return array('errors' => array($data)); |
|
| 42 | } |
||
| 43 | } |
||
| 44 |