1 | <?php |
||
9 | class Item extends AbstractItem implements MutationObject |
||
10 | { |
||
11 | use MutationObjectHandler; |
||
12 | |||
13 | /** |
||
14 | * @var array |
||
15 | */ |
||
16 | protected $config; |
||
17 | |||
18 | /** |
||
19 | * @var bool |
||
20 | */ |
||
21 | private $hasChanged = false; |
||
22 | |||
23 | 100 | public function __construct(array $arguments = [], array $config = [], bool $hasChanged = false) |
|
30 | |||
31 | 72 | public function __get(string $key) |
|
32 | { |
||
33 | 72 | if ((!array_key_exists($key, $this->arguments) || ($this->arguments[$key] === null)) && array_key_exists( |
|
34 | 18 | $key, |
|
35 | 72 | $this->config |
|
36 | 72 | ) && ($this->config[$key]->type !== MutationTypeConfig::SCALAR_DATA_TYPE)) { |
|
37 | 8 | $mutationTypeClass = $this->config[$key]->type; |
|
38 | |||
39 | 8 | $this->arguments[$key] = new $mutationTypeClass([], $this->config[$key]->children); |
|
40 | } |
||
41 | |||
42 | 72 | return parent::__get($key); |
|
43 | } |
||
44 | |||
45 | 32 | public function __set(string $key, $value): void |
|
53 | |||
54 | 6 | public function __unset(string $key): void |
|
60 | |||
61 | 24 | public function set(array $data): void |
|
67 | |||
68 | 56 | public function jsonSerialize(): array |
|
76 | } |
||
77 |