Conditions | 2 |
Paths | 2 |
Total Lines | 12 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 2 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
17 | 2 | public function render(mixed $data, mixed ...$args): string |
|
18 | { |
||
19 | 2 | assert($data instanceof Error); |
|
20 | |||
21 | 2 | $json = ['error' => $data->error]; |
|
22 | |||
23 | 2 | if ($data->debug) { |
|
24 | 1 | $json['description'] = $data->description; |
|
25 | 1 | $json['traceback'] = $data->traceback; |
|
26 | } |
||
27 | |||
28 | 2 | return json_encode($json, JSON_UNESCAPED_SLASHES | JSON_THROW_ON_ERROR); |
|
29 | } |
||
40 |