| Total Complexity | 4 |
| Total Lines | 47 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 12 | final class ErrorData |
||
| 13 | { |
||
| 14 | /** |
||
| 15 | * @var string The content to use as response body. |
||
| 16 | */ |
||
| 17 | private string $content; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * @var array<string, string|string[]> The headers to add to the response. |
||
| 21 | */ |
||
| 22 | private array $headers; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * @param string $content The content to use as response body. |
||
| 26 | * @param array<string, string|string[]> $headers The headers to add to the response. |
||
| 27 | */ |
||
| 28 | 15 | public function __construct(string $content, array $headers = []) |
|
| 32 | 15 | } |
|
| 33 | |||
| 34 | /** |
||
| 35 | * Returns a content to use as response body. |
||
| 36 | * |
||
| 37 | * @return string The content to use as response body. |
||
| 38 | */ |
||
| 39 | 4 | public function __toString(): string |
|
| 42 | } |
||
| 43 | |||
| 44 | /** |
||
| 45 | * Returns a response with error data. |
||
| 46 | * |
||
| 47 | * @param ResponseInterface $response The response for setting error data. |
||
| 48 | * |
||
| 49 | * @return ResponseInterface The response with error data. |
||
| 50 | */ |
||
| 51 | 7 | public function addToResponse(ResponseInterface $response): ResponseInterface |
|
| 61 |