commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
lib
commercetools-api
src
Models
OrderEdit
OrderEditAppliedModel.php
1
<?php
2
3
declare(strict_types=1);
9
namespace
Commercetools\Api\Models\OrderEdit
;
10
11
use
Commercetools\Base\DateTimeImmutableCollection
;
12
use
Commercetools\Base\JsonObject
;
13
use
Commercetools\Base\JsonObjectModel
;
14
use
Commercetools\Base\MapperFactory
;
15
use DateTimeImmutable;
16
use stdClass;
17
21
final
class
OrderEditAppliedModel
extends
JsonObjectModel
implements
OrderEditApplied
22
{
23
public
const
DISCRIMINATOR_VALUE
=
'Applied'
;
28
protected
$type
;
29
34
protected
$appliedAt
;
35
40
protected
$excerptBeforeEdit
;
41
46
protected
$excerptAfterEdit
;
47
48
52
public
function
__construct
(
53
?DateTimeImmutable
$appliedAt
=
null
,
54
?
OrderExcerpt
$excerptBeforeEdit
=
null
,
55
?
OrderExcerpt
$excerptAfterEdit
=
null
,
56
?
string
$type
=
null
57
) {
58
$this->appliedAt =
$appliedAt
;
59
$this->excerptBeforeEdit =
$excerptBeforeEdit
;
60
$this->excerptAfterEdit =
$excerptAfterEdit
;
61
$this->type =
$type
??
self::DISCRIMINATOR_VALUE
;
62
}
63
70
public
function
getType
()
71
{
72
if
(is_null($this->type)) {
74
$data = $this->
raw
(self::FIELD_TYPE);
75
if
(is_null($data)) {
76
return
null
;
77
}
78
$this->type = (string) $data;
79
}
80
81
return
$this->type
;
82
}
83
90
public
function
getAppliedAt
()
91
{
92
if
(is_null($this->appliedAt)) {
94
$data = $this->
raw
(self::FIELD_APPLIED_AT);
95
if
(is_null($data)) {
96
return
null
;
97
}
98
$data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data);
99
if
(
false
=== $data) {
100
return
null
;
101
}
102
$this->appliedAt = $data;
103
}
104
105
return
$this->appliedAt
;
106
}
107
114
public
function
getExcerptBeforeEdit
()
115
{
116
if
(is_null($this->excerptBeforeEdit)) {
118
$data = $this->
raw
(self::FIELD_EXCERPT_BEFORE_EDIT);
119
if
(is_null($data)) {
120
return
null
;
121
}
122
123
$this->excerptBeforeEdit =
OrderExcerptModel::of
($data);
124
}
125
126
return
$this->excerptBeforeEdit
;
127
}
128
135
public
function
getExcerptAfterEdit
()
136
{
137
if
(is_null($this->excerptAfterEdit)) {
139
$data = $this->
raw
(self::FIELD_EXCERPT_AFTER_EDIT);
140
if
(is_null($data)) {
141
return
null
;
142
}
143
144
$this->excerptAfterEdit =
OrderExcerptModel::of
($data);
145
}
146
147
return
$this->excerptAfterEdit
;
148
}
149
150
154
public
function
setAppliedAt
(?DateTimeImmutable
$appliedAt
): void
155
{
156
$this->appliedAt =
$appliedAt
;
157
}
158
162
public
function
setExcerptBeforeEdit
(?
OrderExcerpt
$excerptBeforeEdit
): void
163
{
164
$this->excerptBeforeEdit =
$excerptBeforeEdit
;
165
}
166
170
public
function
setExcerptAfterEdit
(?
OrderExcerpt
$excerptAfterEdit
): void
171
{
172
$this->excerptAfterEdit =
$excerptAfterEdit
;
173
}
174
175
176
#[\ReturnTypeWillChange]
177
public
function
jsonSerialize
()
178
{
179
$data = $this->
toArray
();
180
if
(isset($data[
OrderEditApplied::FIELD_APPLIED_AT
]) && $data[
OrderEditApplied::FIELD_APPLIED_AT
] instanceof \DateTimeImmutable) {
181
$data[
OrderEditApplied::FIELD_APPLIED_AT
] = $data[
OrderEditApplied::FIELD_APPLIED_AT
]->setTimeZone(
new
\DateTimeZone(
'UTC'
))->format(
'c'
);
182
}
183
return
(
object
) $data;
184
}
185
}
Commercetools\Api\Models\OrderEdit\OrderEditAppliedModel
Definition
OrderEditAppliedModel.php:22
Commercetools\Api\Models\OrderEdit\OrderEditAppliedModel\getAppliedAt
getAppliedAt()
Definition
OrderEditAppliedModel.php:90
Commercetools\Api\Models\OrderEdit\OrderEditAppliedModel\__construct
__construct(?DateTimeImmutable $appliedAt=null, ?OrderExcerpt $excerptBeforeEdit=null, ?OrderExcerpt $excerptAfterEdit=null, ?string $type=null)
Definition
OrderEditAppliedModel.php:52
Commercetools\Api\Models\OrderEdit\OrderEditAppliedModel\getType
getType()
Definition
OrderEditAppliedModel.php:70
Commercetools\Api\Models\OrderEdit\OrderEditAppliedModel\getExcerptAfterEdit
getExcerptAfterEdit()
Definition
OrderEditAppliedModel.php:135
Commercetools\Api\Models\OrderEdit\OrderEditAppliedModel\setExcerptBeforeEdit
setExcerptBeforeEdit(?OrderExcerpt $excerptBeforeEdit)
Definition
OrderEditAppliedModel.php:162
Commercetools\Api\Models\OrderEdit\OrderEditAppliedModel\$excerptAfterEdit
$excerptAfterEdit
Definition
OrderEditAppliedModel.php:46
Commercetools\Api\Models\OrderEdit\OrderEditAppliedModel\jsonSerialize
jsonSerialize()
Definition
OrderEditAppliedModel.php:177
Commercetools\Api\Models\OrderEdit\OrderEditAppliedModel\$excerptBeforeEdit
$excerptBeforeEdit
Definition
OrderEditAppliedModel.php:40
Commercetools\Api\Models\OrderEdit\OrderEditAppliedModel\DISCRIMINATOR_VALUE
const DISCRIMINATOR_VALUE
Definition
OrderEditAppliedModel.php:23
Commercetools\Api\Models\OrderEdit\OrderEditAppliedModel\$type
$type
Definition
OrderEditAppliedModel.php:28
Commercetools\Api\Models\OrderEdit\OrderEditAppliedModel\setAppliedAt
setAppliedAt(?DateTimeImmutable $appliedAt)
Definition
OrderEditAppliedModel.php:154
Commercetools\Api\Models\OrderEdit\OrderEditAppliedModel\getExcerptBeforeEdit
getExcerptBeforeEdit()
Definition
OrderEditAppliedModel.php:114
Commercetools\Api\Models\OrderEdit\OrderEditAppliedModel\$appliedAt
$appliedAt
Definition
OrderEditAppliedModel.php:34
Commercetools\Api\Models\OrderEdit\OrderEditAppliedModel\setExcerptAfterEdit
setExcerptAfterEdit(?OrderExcerpt $excerptAfterEdit)
Definition
OrderEditAppliedModel.php:170
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\JsonObjectModel\toArray
toArray()
Definition
JsonObjectModel.php:32
Commercetools\Base\MapperFactory
Definition
MapperFactory.php:16
Commercetools\Api\Models\OrderEdit\OrderEditApplied
Definition
OrderEditApplied.php:16
Commercetools\Api\Models\OrderEdit\OrderEditApplied\FIELD_APPLIED_AT
const FIELD_APPLIED_AT
Definition
OrderEditApplied.php:17
Commercetools\Api\Models\OrderEdit\OrderExcerpt
Definition
OrderExcerpt.php:17
Commercetools\Base\JsonObject
Definition
JsonObject.php:15
Commercetools\Api\Models\OrderEdit
Definition
OrderEdit.php:9
Generated by
1.9.8