commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
src
Api
Models
Product
NestedAttribute.php
1
<?php
2
3
declare(strict_types=1);
4
5
namespace
Commercetools\Api\Models\Product
;
6
7
use
Commercetools\Base\MapperSequence
;
8
use
Commercetools\Exception\InvalidArgumentException
;
9
use stdClass;
10
16
class
NestedAttribute
extends
MapperSequence
17
{
25
public
function
add
($value)
26
{
27
if
(!$value instanceof
Attribute
) {
28
throw
new
InvalidArgumentException
();
29
}
30
$this->
store
($value);
31
32
return
$this;
33
}
34
38
protected
function
mapper
()
39
{
40
return
function
(
int
$index): ?
Attribute
{
41
$data = $this->
get
($index);
42
if
($data instanceof
Attribute
|| $data ==
null
) {
43
return
$data;
44
}
45
$data =
AttributeModel::of
($data);
46
$this->
set
($data, $index);
47
48
return
$data;
49
};
50
}
51
}
Commercetools\Api\Models\Product\NestedAttribute
Definition:
NestedAttribute.php:17
Commercetools\Api\Models\Product\NestedAttribute\mapper
mapper()
Definition:
NestedAttribute.php:38
Commercetools\Api\Models\Product\NestedAttribute\add
add($value)
Definition:
NestedAttribute.php:25
Commercetools\Base\BaseJsonObject\of
static of($data=null)
Definition:
BaseJsonObject.php:26
Commercetools\Base\MapperSequence
Definition:
MapperSequence.php:19
Commercetools\Base\MapperSequence\store
store($value)
Definition:
MapperSequence.php:106
Commercetools\Exception\InvalidArgumentException
Definition:
InvalidArgumentException.php:15
Commercetools\Api\Models\Product\Attribute
Definition:
Attribute.php:15
Commercetools\Api\Models\Product
Definition:
AttributeAccessor.php:4
Generated by
1.9.1