| Total Complexity | 5 |
| Total Lines | 45 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 10 | class ErrorResponse implements IResponse |
||
| 11 | { |
||
| 12 | |||
| 13 | /** |
||
| 14 | * @param IResponse $response Wrapped response with data |
||
| 15 | */ |
||
| 16 | public function __construct( |
||
| 17 | private readonly IResponse $response, |
||
| 18 | private readonly int $code = 500, |
||
| 19 | ) |
||
| 20 | { |
||
| 21 | } |
||
| 22 | |||
| 23 | /** |
||
| 24 | * Get response data |
||
| 25 | * @return iterable<string|int, mixed>|stdClass|string |
||
| 26 | */ |
||
| 27 | public function getData(): iterable|stdClass|string |
||
| 28 | { |
||
| 29 | return $this->response->getData(); |
||
| 30 | } |
||
| 31 | |||
| 32 | /** |
||
| 33 | * Get response content type |
||
| 34 | */ |
||
| 35 | public function getContentType(): ?string |
||
| 38 | } |
||
| 39 | |||
| 40 | /** |
||
| 41 | * Get response data |
||
| 42 | */ |
||
| 43 | public function getCode(): int |
||
| 46 | } |
||
| 47 | |||
| 48 | /** |
||
| 49 | * Sends response to output |
||
| 50 | */ |
||
| 51 | public function send(Http\IRequest $httpRequest, Http\IResponse $httpResponse): void |
||
| 55 | } |
||
| 56 | } |
||
| 57 |