| 1 | <?php |
||
| 8 | |||
| 9 | trait ItemsPart { |
||
| 10 | |||
| 11 | /** @var */ |
||
| 12 | private $items; |
||
| 13 | 9 | ||
| 14 | 9 | private function parseItems(Map $data) { |
|
| 15 | 6 | if ($data->has('items')) { |
|
| 16 | 6 | $this->items = new Items($data->get('items')); |
|
| 17 | 9 | } |
|
| 18 | } |
||
| 19 | |||
| 20 | private function mergeItems(static $model, $overwrite = false) { |
||
|
|
|||
| 21 | if (null === $this->items) { |
||
| 22 | $this->items = clone $model->items; |
||
| 23 | } elseif (null !== $model->items) { |
||
| 24 | $this->items->merge($model->items, $overwrite); |
||
| 25 | } |
||
| 26 | } |
||
| 27 | |||
| 28 | /** |
||
| 29 | * Returns the items |
||
| 30 | * |
||
| 31 | * @return Items |
||
| 32 | */ |
||
| 41 |