commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
lib
commercetools-base
src
Base
JsonObjectCollection.php
1
<?php
2
3
declare(strict_types=1);
10
namespace
Commercetools\Base
;
11
12
use
Commercetools\Exception\InvalidArgumentException
;
13
19
class
JsonObjectCollection
extends
MapperSequence
20
{
27
public
function
add
($value)
28
{
29
if
(!$value instanceof
JsonObject
) {
30
throw
new
InvalidArgumentException
();
31
}
32
$this->
store
($value);
33
34
return
$this;
35
}
36
40
protected
function
mapper
()
41
{
42
return
function
(
int
$index): ?
JsonObject
{
43
$data = $this->
get
($index);
44
if
(!is_null($data) && !$data instanceof
JsonObject
) {
45
$data =
JsonObjectModel::of
($data);
46
$this->
set
($data, $index);
47
}
48
return
$data;
49
};
50
}
51
}
Commercetools\Base\BaseJsonObject\of
static of($data=null)
Definition:
BaseJsonObject.php:26
Commercetools\Base\JsonObjectCollection
Definition:
JsonObjectCollection.php:20
Commercetools\Base\JsonObjectCollection\add
add($value)
Definition:
JsonObjectCollection.php:27
Commercetools\Base\JsonObjectCollection\mapper
mapper()
Definition:
JsonObjectCollection.php:40
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\Base\JsonObject
Definition:
JsonObject.php:15
Commercetools\Base
Definition:
MapperArraySequence.php:10
Generated by
1.9.1