commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
CustomerSearchIndexingStatusResponseModel.php
1<?php
2
3declare(strict_types=1);
10
15use DateTimeImmutable;
16use stdClass;
17
22{
27 protected $status;
28
33 protected $states;
34
39 protected $startedAt;
40
45 protected $lastModifiedAt;
46
51 protected $retryCount;
52
53
57 public function __construct(
58 ?string $status = null,
60 ?DateTimeImmutable $startedAt = null,
61 ?DateTimeImmutable $lastModifiedAt = null,
62 ?int $retryCount = null
63 ) {
64 $this->status = $status;
65 $this->states = $states;
66 $this->startedAt = $startedAt;
67 $this->lastModifiedAt = $lastModifiedAt;
68 $this->retryCount = $retryCount;
69 }
70
77 public function getStatus()
78 {
79 if (is_null($this->status)) {
81 $data = $this->raw(self::FIELD_STATUS);
82 if (is_null($data)) {
83 return null;
84 }
85 $this->status = (string) $data;
86 }
87
88 return $this->status;
89 }
90
97 public function getStates()
98 {
99 if (is_null($this->states)) {
101 $data = $this->raw(self::FIELD_STATES);
102 if (is_null($data)) {
103 return null;
104 }
105
106 $this->states = CustomerIndexingProgressModel::of($data);
107 }
108
109 return $this->states;
110 }
111
118 public function getStartedAt()
119 {
120 if (is_null($this->startedAt)) {
122 $data = $this->raw(self::FIELD_STARTED_AT);
123 if (is_null($data)) {
124 return null;
125 }
126 $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data);
127 if (false === $data) {
128 return null;
129 }
130 $this->startedAt = $data;
131 }
132
133 return $this->startedAt;
134 }
135
142 public function getLastModifiedAt()
143 {
144 if (is_null($this->lastModifiedAt)) {
146 $data = $this->raw(self::FIELD_LAST_MODIFIED_AT);
147 if (is_null($data)) {
148 return null;
149 }
150 $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data);
151 if (false === $data) {
152 return null;
153 }
154 $this->lastModifiedAt = $data;
155 }
156
158 }
159
166 public function getRetryCount()
167 {
168 if (is_null($this->retryCount)) {
170 $data = $this->raw(self::FIELD_RETRY_COUNT);
171 if (is_null($data)) {
172 return null;
173 }
174 $this->retryCount = (int) $data;
175 }
176
177 return $this->retryCount;
178 }
179
180
184 public function setStatus(?string $status): void
185 {
186 $this->status = $status;
187 }
188
193 {
194 $this->states = $states;
195 }
196
200 public function setStartedAt(?DateTimeImmutable $startedAt): void
201 {
202 $this->startedAt = $startedAt;
203 }
204
208 public function setLastModifiedAt(?DateTimeImmutable $lastModifiedAt): void
209 {
210 $this->lastModifiedAt = $lastModifiedAt;
211 }
212
216 public function setRetryCount(?int $retryCount): void
217 {
218 $this->retryCount = $retryCount;
219 }
220
221
222 #[\ReturnTypeWillChange]
223 public function jsonSerialize()
224 {
225 $data = $this->toArray();
227 $data[CustomerSearchIndexingStatusResponse::FIELD_STARTED_AT] = $data[CustomerSearchIndexingStatusResponse::FIELD_STARTED_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c');
228 }
229
232 }
233 return (object) $data;
234 }
235}
__construct(?string $status=null, ?CustomerIndexingProgress $states=null, ?DateTimeImmutable $startedAt=null, ?DateTimeImmutable $lastModifiedAt=null, ?int $retryCount=null)