| Total Complexity | 2 |
| Total Lines | 27 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 10 | final class ResponseBuilder implements ResponseBuilderInterface |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * @return array{error: array{message: string, code: int, id: string}} |
||
| 14 | */ |
||
| 15 | 1 | public function buildErrorResponse( |
|
| 16 | Throwable $e, |
||
| 17 | UuidInterface $uuid, |
||
| 18 | ): array { |
||
| 19 | 1 | return [ |
|
| 20 | 1 | 'error' => [ |
|
| 21 | 1 | 'message' => $e->getMessage(), |
|
| 22 | 1 | 'code' => $e->getCode(), |
|
| 23 | 1 | 'id' => $uuid->toString(), |
|
| 24 | 1 | ], |
|
| 25 | 1 | ]; |
|
| 26 | } |
||
| 27 | |||
| 28 | /** |
||
| 29 | * @param array<mixed, mixed> $data |
||
| 30 | * |
||
| 31 | * @return array{data: array<mixed, mixed>} |
||
| 32 | */ |
||
| 33 | 1 | public function buildResponse(array $data): array |
|
| 37 | 1 | ]; |
|
| 38 | } |
||
| 40 |