commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
lib
commercetools-api
src
Models
Cart
ReplicaCartDraftModel.php
1
<?php
2
3
declare(strict_types=1);
9
namespace
Commercetools\Api\Models\Cart
;
10
11
use
Commercetools\Api\Models\Order\OrderReference
;
12
use
Commercetools\Api\Models\Order\OrderReferenceModel
;
13
use
Commercetools\Base\DateTimeImmutableCollection
;
14
use
Commercetools\Base\JsonObject
;
15
use
Commercetools\Base\JsonObjectModel
;
16
use
Commercetools\Base\MapperFactory
;
17
use stdClass;
18
22
final
class
ReplicaCartDraftModel
extends
JsonObjectModel
implements
ReplicaCartDraft
23
{
28
protected
$reference
;
29
34
protected
$key
;
35
36
40
public
function
__construct
(
41
?
JsonObject
$reference
=
null
,
42
?
string
$key
=
null
43
) {
44
$this->reference =
$reference
;
45
$this->key =
$key
;
46
}
47
54
public
function
getReference
()
55
{
56
if
(is_null($this->reference)) {
58
$data = $this->
raw
(self::FIELD_REFERENCE);
59
if
(is_null($data)) {
60
return
null
;
61
}
62
$this->reference = $data;
63
}
64
65
return
$this->reference
;
66
}
67
74
public
function
getKey
()
75
{
76
if
(is_null($this->key)) {
78
$data = $this->
raw
(self::FIELD_KEY);
79
if
(is_null($data)) {
80
return
null
;
81
}
82
$this->key = (string) $data;
83
}
84
85
return
$this->key
;
86
}
87
93
public
function
getReferenceAsCartReference
()
94
{
96
$data = $this->
raw
(self::FIELD_REFERENCE);
97
if
(is_null($data)) {
98
return
null
;
99
}
100
101
return
CartReferenceModel::of
($data);
102
}
103
109
public
function
getReferenceAsOrderReference
()
110
{
112
$data = $this->
raw
(self::FIELD_REFERENCE);
113
if
(is_null($data)) {
114
return
null
;
115
}
116
117
return
OrderReferenceModel::of
($data);
118
}
119
123
public
function
setReference
(?
JsonObject
$reference
): void
124
{
125
$this->reference =
$reference
;
126
}
127
131
public
function
setKey
(?
string
$key
): void
132
{
133
$this->key =
$key
;
134
}
135
}
Commercetools\Api\Models\Cart\ReplicaCartDraftModel
Definition:
ReplicaCartDraftModel.php:23
Commercetools\Api\Models\Cart\ReplicaCartDraftModel\getReference
getReference()
Definition:
ReplicaCartDraftModel.php:54
Commercetools\Api\Models\Cart\ReplicaCartDraftModel\setReference
setReference(?JsonObject $reference)
Definition:
ReplicaCartDraftModel.php:123
Commercetools\Api\Models\Cart\ReplicaCartDraftModel\getKey
getKey()
Definition:
ReplicaCartDraftModel.php:74
Commercetools\Api\Models\Cart\ReplicaCartDraftModel\getReferenceAsCartReference
getReferenceAsCartReference()
Definition:
ReplicaCartDraftModel.php:93
Commercetools\Api\Models\Cart\ReplicaCartDraftModel\$reference
$reference
Definition:
ReplicaCartDraftModel.php:28
Commercetools\Api\Models\Cart\ReplicaCartDraftModel\getReferenceAsOrderReference
getReferenceAsOrderReference()
Definition:
ReplicaCartDraftModel.php:109
Commercetools\Api\Models\Cart\ReplicaCartDraftModel\setKey
setKey(?string $key)
Definition:
ReplicaCartDraftModel.php:131
Commercetools\Api\Models\Cart\ReplicaCartDraftModel\$key
$key
Definition:
ReplicaCartDraftModel.php:34
Commercetools\Api\Models\Cart\ReplicaCartDraftModel\__construct
__construct(?JsonObject $reference=null, ?string $key=null)
Definition:
ReplicaCartDraftModel.php:40
Commercetools\Api\Models\Order\OrderReferenceModel
Definition:
OrderReferenceModel.php:23
Commercetools\Base\BaseJsonObject\raw
raw(string $field)
Definition:
BaseJsonObject.php:57
Commercetools\Base\BaseJsonObject\of
static of($data=null)
Definition:
BaseJsonObject.php:26
Commercetools\Base\DateTimeImmutableCollection
Definition:
DateTimeImmutableCollection.php:21
Commercetools\Base\JsonObjectModel
Definition:
JsonObjectModel.php:15
Commercetools\Base\MapperFactory
Definition:
MapperFactory.php:16
Commercetools\Api\Models\Cart\ReplicaCartDraft
Definition:
ReplicaCartDraft.php:16
Commercetools\Api\Models\Order\OrderReference
Definition:
OrderReference.php:16
Commercetools\Base\JsonObject
Definition:
JsonObject.php:15
Commercetools\Api\Models\Cart
Definition:
Cart.php:9
Generated by
1.9.1