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
ApprovalFlow
ApprovalFlowRejectionModel.php
1
<?php
2
3
declare(strict_types=1);
9
namespace
Commercetools\Api\Models\ApprovalFlow
;
10
11
use
Commercetools\Api\Models\BusinessUnit\Associate
;
12
use
Commercetools\Api\Models\BusinessUnit\AssociateModel
;
13
use
Commercetools\Base\DateTimeImmutableCollection
;
14
use
Commercetools\Base\JsonObject
;
15
use
Commercetools\Base\JsonObjectModel
;
16
use
Commercetools\Base\MapperFactory
;
17
use DateTimeImmutable;
18
use stdClass;
19
23
final
class
ApprovalFlowRejectionModel
extends
JsonObjectModel
implements
ApprovalFlowRejection
24
{
29
protected
$rejecter
;
30
35
protected
$rejectedAt
;
36
41
protected
$reason
;
42
43
47
public
function
__construct
(
48
?
Associate
$rejecter
=
null
,
49
?DateTimeImmutable
$rejectedAt
=
null
,
50
?
string
$reason
=
null
51
) {
52
$this->rejecter =
$rejecter
;
53
$this->rejectedAt =
$rejectedAt
;
54
$this->reason =
$reason
;
55
}
56
63
public
function
getRejecter
()
64
{
65
if
(is_null($this->rejecter)) {
67
$data = $this->
raw
(self::FIELD_REJECTER);
68
if
(is_null($data)) {
69
return
null
;
70
}
71
72
$this->rejecter = AssociateModel::of($data);
73
}
74
75
return
$this->rejecter
;
76
}
77
84
public
function
getRejectedAt
()
85
{
86
if
(is_null($this->rejectedAt)) {
88
$data = $this->
raw
(self::FIELD_REJECTED_AT);
89
if
(is_null($data)) {
90
return
null
;
91
}
92
$data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data);
93
if
(
false
=== $data) {
94
return
null
;
95
}
96
$this->rejectedAt = $data;
97
}
98
99
return
$this->rejectedAt
;
100
}
101
108
public
function
getReason
()
109
{
110
if
(is_null($this->reason)) {
112
$data = $this->
raw
(self::FIELD_REASON);
113
if
(is_null($data)) {
114
return
null
;
115
}
116
$this->reason = (string) $data;
117
}
118
119
return
$this->reason
;
120
}
121
122
126
public
function
setRejecter
(?
Associate
$rejecter
): void
127
{
128
$this->rejecter =
$rejecter
;
129
}
130
134
public
function
setRejectedAt
(?DateTimeImmutable
$rejectedAt
): void
135
{
136
$this->rejectedAt =
$rejectedAt
;
137
}
138
142
public
function
setReason
(?
string
$reason
): void
143
{
144
$this->reason =
$reason
;
145
}
146
147
148
#[\ReturnTypeWillChange]
149
public
function
jsonSerialize
()
150
{
151
$data = $this->
toArray
();
152
if
(isset($data[
ApprovalFlowRejection::FIELD_REJECTED_AT
]) && $data[
ApprovalFlowRejection::FIELD_REJECTED_AT
] instanceof \DateTimeImmutable) {
153
$data[
ApprovalFlowRejection::FIELD_REJECTED_AT
] = $data[
ApprovalFlowRejection::FIELD_REJECTED_AT
]->setTimeZone(
new
\DateTimeZone(
'UTC'
))->format(
'c'
);
154
}
155
return
(
object
) $data;
156
}
157
}
Commercetools\Api\Models\ApprovalFlow\ApprovalFlowRejectionModel
Definition
ApprovalFlowRejectionModel.php:24
Commercetools\Api\Models\ApprovalFlow\ApprovalFlowRejectionModel\setRejecter
setRejecter(?Associate $rejecter)
Definition
ApprovalFlowRejectionModel.php:126
Commercetools\Api\Models\ApprovalFlow\ApprovalFlowRejectionModel\__construct
__construct(?Associate $rejecter=null, ?DateTimeImmutable $rejectedAt=null, ?string $reason=null)
Definition
ApprovalFlowRejectionModel.php:47
Commercetools\Api\Models\ApprovalFlow\ApprovalFlowRejectionModel\$reason
$reason
Definition
ApprovalFlowRejectionModel.php:41
Commercetools\Api\Models\ApprovalFlow\ApprovalFlowRejectionModel\$rejectedAt
$rejectedAt
Definition
ApprovalFlowRejectionModel.php:35
Commercetools\Api\Models\ApprovalFlow\ApprovalFlowRejectionModel\getRejectedAt
getRejectedAt()
Definition
ApprovalFlowRejectionModel.php:84
Commercetools\Api\Models\ApprovalFlow\ApprovalFlowRejectionModel\setReason
setReason(?string $reason)
Definition
ApprovalFlowRejectionModel.php:142
Commercetools\Api\Models\ApprovalFlow\ApprovalFlowRejectionModel\getRejecter
getRejecter()
Definition
ApprovalFlowRejectionModel.php:63
Commercetools\Api\Models\ApprovalFlow\ApprovalFlowRejectionModel\setRejectedAt
setRejectedAt(?DateTimeImmutable $rejectedAt)
Definition
ApprovalFlowRejectionModel.php:134
Commercetools\Api\Models\ApprovalFlow\ApprovalFlowRejectionModel\getReason
getReason()
Definition
ApprovalFlowRejectionModel.php:108
Commercetools\Api\Models\ApprovalFlow\ApprovalFlowRejectionModel\jsonSerialize
jsonSerialize()
Definition
ApprovalFlowRejectionModel.php:149
Commercetools\Api\Models\ApprovalFlow\ApprovalFlowRejectionModel\$rejecter
$rejecter
Definition
ApprovalFlowRejectionModel.php:29
Commercetools\Api\Models\BusinessUnit\AssociateModel
Definition
AssociateModel.php:23
Commercetools\Base\BaseJsonObject\raw
raw(string $field)
Definition
BaseJsonObject.php:57
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\ApprovalFlow\ApprovalFlowRejection
Definition
ApprovalFlowRejection.php:17
Commercetools\Api\Models\ApprovalFlow\ApprovalFlowRejection\FIELD_REJECTED_AT
const FIELD_REJECTED_AT
Definition
ApprovalFlowRejection.php:19
Commercetools\Api\Models\BusinessUnit\Associate
Definition
Associate.php:16
Commercetools\Base\JsonObject
Definition
JsonObject.php:15
Commercetools\Api\Models\ApprovalFlow
Definition
ApprovalFlow.php:9
Generated by
1.9.8