commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
src
Api
Models
Product
NestedAttributeCollection.php
1
<?php
2
3
declare(strict_types=1);
9
namespace
Commercetools\Api\Models\Product
;
10
11
use
Commercetools\Base\MapperArraySequence
;
12
use
Commercetools\Exception\InvalidArgumentException
;
13
20
class
NestedAttributeCollection
extends
MapperArraySequence
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
}
Commercetools\Api\Models\Product\NestedAttributeCollection
Definition:
NestedAttributeCollection.php:21
Commercetools\Api\Models\Product\NestedAttributeCollection\mapper
mapper()
Definition:
NestedAttributeCollection.php:42
Commercetools\Api\Models\Product\NestedAttributeCollection\add
add($value)
Definition:
NestedAttributeCollection.php:29
Commercetools\Api\Models\Product\NestedAttribute
Definition:
NestedAttribute.php:17
Commercetools\Base\MapperArraySequence
Definition:
MapperArraySequence.php:20
Commercetools\Base\MapperArraySequence\store
store($value)
Definition:
MapperArraySequence.php:106
Commercetools\Base\MapperSequence\fromArray
static fromArray(array $data)
Definition:
MapperSequence.php:56
Commercetools\Exception\InvalidArgumentException
Definition:
InvalidArgumentException.php:15
Commercetools\Api\Models\Product
Definition:
AttributeAccessor.php:4
Generated by
1.9.1