| Conditions | 1 |
| Paths | 1 |
| Total Lines | 16 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 13 |
| CRAP Score | 1 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 18 | 1 | public function render(mixed $data, mixed ...$args): string |
|
| 19 | { |
||
| 20 | 1 | assert(is_array($data)); |
|
| 21 | 1 | assert(isset($data['error'])); |
|
| 22 | 1 | assert($data['error'] instanceof Error); |
|
| 23 | |||
| 24 | 1 | $error = $data['error']; |
|
| 25 | 1 | $json = [ |
|
| 26 | 1 | 'error' => $error->error, |
|
| 27 | 1 | 'description' => $error->description, |
|
| 28 | 1 | 'traceback' => $error->traceback, |
|
| 29 | 1 | 'code' => $error->code, |
|
| 30 | 1 | 'payload' => $error->payload, |
|
| 31 | 1 | ]; |
|
| 32 | |||
| 33 | 1 | return json_encode($json, JSON_UNESCAPED_SLASHES | JSON_THROW_ON_ERROR); |
|
| 34 | } |
||
| 45 |