Conditions | 1 |
Paths | 1 |
Total Lines | 15 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
33 | public function convert(Throwable $throwable): string |
||
34 | { |
||
35 | $inspector = new ExceptionInspector($throwable); |
||
36 | $jsonApiError = new ErrorObject( |
||
37 | title: $this->clearTitle($throwable), |
||
38 | detail: $this->details($throwable, $inspector), |
||
39 | status: (string) $inspector->statusCode() |
||
40 | ); |
||
41 | $response = [ |
||
42 | "jsonapi" => ["version" => JsonApi::JSON_API_11], |
||
43 | "errors" => [ |
||
44 | $jsonApiError->withIdentifier(uniqid()) |
||
45 | ] |
||
46 | ]; |
||
47 | return json_encode($response, JSON_UNESCAPED_UNICODE|JSON_PRETTY_PRINT); |
||
48 | } |
||
58 |