| Total Complexity | 11 |
| Total Lines | 57 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 5 | class DataResponseProvider |
||
| 6 | { |
||
| 7 | /** @var mixed */ |
||
| 8 | private $data; |
||
| 9 | private ?int $code = null; |
||
| 10 | private array $headers = []; |
||
| 11 | private ?string $format = null; |
||
| 12 | private array $params = []; |
||
| 13 | |||
| 14 | public function __construct($data, string $format = null, array $params = []) |
||
|
|
|||
| 15 | { |
||
| 16 | $this->data = $data; |
||
| 17 | $this->format = $format; |
||
| 18 | } |
||
| 19 | public function getCode(): ?int |
||
| 20 | { |
||
| 21 | return $this->code; |
||
| 22 | } |
||
| 23 | public function getHeaders(): array |
||
| 24 | { |
||
| 25 | return $this->headers; |
||
| 26 | } |
||
| 27 | public function getFormat(): ?string |
||
| 30 | } |
||
| 31 | public function getParams(): array |
||
| 32 | { |
||
| 33 | return $this->params; |
||
| 34 | } |
||
| 35 | public function getData() |
||
| 36 | { |
||
| 37 | return $this->data; |
||
| 38 | } |
||
| 39 | |||
| 40 | public function setCode(?int $code = 200): self |
||
| 44 | } |
||
| 45 | public function setHeaders(array $headers = []): self |
||
| 46 | { |
||
| 47 | $this->headers = $headers; |
||
| 48 | return $this; |
||
| 49 | } |
||
| 50 | public function addHeaders(array $headers = []): self |
||
| 51 | { |
||
| 52 | $this->headers = [...$this->headers, ...$headers]; |
||
| 53 | return $this; |
||
| 54 | } |
||
| 55 | public function setFormat(?string $format, array $params = null): self |
||
| 62 | } |
||
| 63 | } |
||
| 64 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.