commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
NestedAttributeCollection.php
1<?php
2
3declare(strict_types=1);
10
13
21{
29 public function add($value)
30 {
31 if (!$value instanceof NestedAttribute) {
32 throw new InvalidArgumentException();
33 }
34 $this->store($value);
35
36 return $this;
37 }
38
42 protected function mapper()
43 {
44 return function (int $index): ?NestedAttribute {
45 $data = $this->get($index);
46 if (is_array($data)) {
47 $data = NestedAttribute::fromArray($data);
48 $this->set($data, $index);
49 }
50
51 return $data;
52 };
53 }
54}
static fromArray(array $data)