Total Complexity | 7 |
Total Lines | 37 |
Duplicated Lines | 0 % |
Changes | 6 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
12 | class Payload implements JsonSerializable, IteratorAggregate, Countable |
||
13 | { |
||
14 | use KeyValueList { |
||
15 | set as protected; |
||
16 | delete as protected; |
||
17 | } |
||
18 | |||
19 | public function __construct(array $data = []) |
||
20 | { |
||
21 | foreach ($data as $item => $value) { |
||
22 | $this->insert($item, $value); |
||
23 | } |
||
24 | } |
||
25 | |||
26 | protected function insert($item, $value) |
||
27 | { |
||
28 | $this->set($item, $value); |
||
29 | } |
||
30 | |||
31 | protected function assertRequiredParameters(array $required): void |
||
32 | { |
||
33 | Assert::requiredParameters($required, $this->toArray(), $this); |
||
34 | } |
||
35 | |||
36 | public function __get($name) |
||
37 | { |
||
38 | return $this->get($name); |
||
39 | } |
||
40 | |||
41 | public function __call($name, $arguments) |
||
42 | { |
||
43 | return $this->get($name); |
||
44 | } |
||
45 | |||
46 | public function jsonSerialize(): array |
||
49 | } |
||
50 | } |
||
51 |