| Total Complexity | 6 |
| Total Lines | 52 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 7 | class Response extends BaseResponse implements |
||
| 8 | ExtendedResponseInterface |
||
| 9 | { |
||
| 10 | protected mixed $customContent; |
||
| 11 | |||
| 12 | /** |
||
| 13 | * @param mixed $data The response data |
||
| 14 | * @param int $status The response status code |
||
| 15 | * @param array $headers An array of response headers |
||
| 16 | * @param bool $json If the data is already a JSON string |
||
| 17 | */ |
||
| 18 | 13 | public function __construct($data = null, int $status = 200, array $headers = [], bool $json = false) |
|
|
|
|||
| 19 | { |
||
| 20 | 13 | parent::__construct('', $status, $headers); |
|
| 21 | |||
| 22 | 13 | if (null === $data) { |
|
| 23 | $data = new \ArrayObject(); |
||
| 24 | } |
||
| 25 | |||
| 26 | $this->setCustomContent($data); |
||
| 27 | } |
||
| 28 | |||
| 29 | /** |
||
| 30 | * Sets the response content. |
||
| 31 | * |
||
| 32 | * We need to allow all sorts of content, not just the ones the regular Response setContent() allows |
||
| 33 | * |
||
| 34 | * @param mixed $content |
||
| 35 | * @return Response |
||
| 36 | * @api |
||
| 37 | */ |
||
| 38 | public function setCustomContent(mixed $content): static |
||
| 39 | { |
||
| 40 | $this->customContent = $content; |
||
| 41 | |||
| 42 | return $this; |
||
| 43 | } |
||
| 44 | |||
| 45 | public function getCustomContent(): mixed |
||
| 48 | } |
||
| 49 | |||
| 50 | public function setContent(?string $content): static |
||
| 51 | { |
||
| 52 | $this->customContent = $content; |
||
| 53 | return parent::setContent($content); |
||
| 54 | } |
||
| 55 | |||
| 56 | public function getContent(): string|false |
||
| 59 | } |
||
| 60 | } |
||
| 61 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.