Total Complexity | 6 |
Total Lines | 50 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php declare(strict_types=1); |
||
10 | class Response implements ResponseInterface |
||
11 | { |
||
12 | /** |
||
13 | * @var mixed filtered data |
||
14 | */ |
||
15 | private $data; |
||
16 | |||
17 | /** |
||
18 | * @var array meta data (e.g. pagination info) |
||
19 | */ |
||
20 | private $meta; |
||
21 | |||
22 | 6 | public function __construct($data = null, array $meta = array()) |
|
23 | { |
||
24 | 6 | $this->data = $data; |
|
25 | 6 | $this->meta = $meta; |
|
26 | 6 | } |
|
27 | |||
28 | 4 | public function getData() |
|
29 | { |
||
30 | 4 | return $this->data; |
|
31 | } |
||
32 | |||
33 | 4 | public function setData($data): ResponseInterface |
|
34 | { |
||
35 | 4 | $this->data = $data; |
|
36 | |||
37 | 4 | return $this; |
|
38 | } |
||
39 | |||
40 | /** |
||
41 | * @return array |
||
42 | */ |
||
43 | 5 | public function getMeta(): array |
|
44 | { |
||
45 | 5 | return $this->meta; |
|
46 | } |
||
47 | |||
48 | 1 | public function setMeta(array $meta): ResponseInterface |
|
49 | { |
||
50 | 1 | $this->meta = $meta; |
|
51 | |||
52 | 1 | return $this; |
|
53 | } |
||
54 | |||
55 | 4 | public function addMeta(string $field, $value): ResponseInterface |
|
60 | } |
||
61 | } |
||
62 |