commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
ParcelMeasurementsUpdatedMessageModel.php
1<?php
2
3declare(strict_types=1);
10
23use DateTimeImmutable;
24use stdClass;
25
30{
31 public const DISCRIMINATOR_VALUE = 'ParcelMeasurementsUpdated';
36 protected $id;
37
42 protected $version;
43
48 protected $createdAt;
49
54 protected $lastModifiedAt;
55
60 protected $lastModifiedBy;
61
66 protected $createdBy;
67
72 protected $sequenceNumber;
73
78 protected $resource;
79
85
90 protected $type;
91
97
102 protected $deliveryId;
103
108 protected $parcelId;
109
114 protected $measurements;
115
120 protected $shippingKey;
121
122
126 public function __construct(
127 ?string $id = null,
128 ?int $version = null,
129 ?DateTimeImmutable $createdAt = null,
130 ?DateTimeImmutable $lastModifiedAt = null,
132 ?CreatedBy $createdBy = null,
133 ?int $sequenceNumber = null,
134 ?Reference $resource = null,
135 ?int $resourceVersion = null,
137 ?string $deliveryId = null,
138 ?string $parcelId = null,
140 ?string $shippingKey = null,
141 ?string $type = null
142 ) {
143 $this->id = $id;
144 $this->version = $version;
145 $this->createdAt = $createdAt;
146 $this->lastModifiedAt = $lastModifiedAt;
147 $this->lastModifiedBy = $lastModifiedBy;
148 $this->createdBy = $createdBy;
149 $this->sequenceNumber = $sequenceNumber;
150 $this->resource = $resource;
151 $this->resourceVersion = $resourceVersion;
152 $this->resourceUserProvidedIdentifiers = $resourceUserProvidedIdentifiers;
153 $this->deliveryId = $deliveryId;
154 $this->parcelId = $parcelId;
155 $this->measurements = $measurements;
156 $this->shippingKey = $shippingKey;
157 $this->type = $type ?? self::DISCRIMINATOR_VALUE;
158 }
159
166 public function getId()
167 {
168 if (is_null($this->id)) {
170 $data = $this->raw(self::FIELD_ID);
171 if (is_null($data)) {
172 return null;
173 }
174 $this->id = (string) $data;
175 }
176
177 return $this->id;
178 }
179
186 public function getVersion()
187 {
188 if (is_null($this->version)) {
190 $data = $this->raw(self::FIELD_VERSION);
191 if (is_null($data)) {
192 return null;
193 }
194 $this->version = (int) $data;
195 }
196
197 return $this->version;
198 }
199
206 public function getCreatedAt()
207 {
208 if (is_null($this->createdAt)) {
210 $data = $this->raw(self::FIELD_CREATED_AT);
211 if (is_null($data)) {
212 return null;
213 }
214 $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data);
215 if (false === $data) {
216 return null;
217 }
218 $this->createdAt = $data;
219 }
220
221 return $this->createdAt;
222 }
223
230 public function getLastModifiedAt()
231 {
232 if (is_null($this->lastModifiedAt)) {
234 $data = $this->raw(self::FIELD_LAST_MODIFIED_AT);
235 if (is_null($data)) {
236 return null;
237 }
238 $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data);
239 if (false === $data) {
240 return null;
241 }
242 $this->lastModifiedAt = $data;
243 }
244
246 }
247
254 public function getLastModifiedBy()
255 {
256 if (is_null($this->lastModifiedBy)) {
258 $data = $this->raw(self::FIELD_LAST_MODIFIED_BY);
259 if (is_null($data)) {
260 return null;
261 }
262
263 $this->lastModifiedBy = LastModifiedByModel::of($data);
264 }
265
267 }
268
275 public function getCreatedBy()
276 {
277 if (is_null($this->createdBy)) {
279 $data = $this->raw(self::FIELD_CREATED_BY);
280 if (is_null($data)) {
281 return null;
282 }
283
284 $this->createdBy = CreatedByModel::of($data);
285 }
286
287 return $this->createdBy;
288 }
289
297 public function getSequenceNumber()
298 {
299 if (is_null($this->sequenceNumber)) {
301 $data = $this->raw(self::FIELD_SEQUENCE_NUMBER);
302 if (is_null($data)) {
303 return null;
304 }
305 $this->sequenceNumber = (int) $data;
306 }
307
309 }
310
317 public function getResource()
318 {
319 if (is_null($this->resource)) {
321 $data = $this->raw(self::FIELD_RESOURCE);
322 if (is_null($data)) {
323 return null;
324 }
325 $className = ReferenceModel::resolveDiscriminatorClass($data);
326 $this->resource = $className::of($data);
327 }
328
329 return $this->resource;
330 }
331
338 public function getResourceVersion()
339 {
340 if (is_null($this->resourceVersion)) {
342 $data = $this->raw(self::FIELD_RESOURCE_VERSION);
343 if (is_null($data)) {
344 return null;
345 }
346 $this->resourceVersion = (int) $data;
347 }
348
350 }
351
358 public function getType()
359 {
360 if (is_null($this->type)) {
362 $data = $this->raw(self::FIELD_TYPE);
363 if (is_null($data)) {
364 return null;
365 }
366 $this->type = (string) $data;
367 }
368
369 return $this->type;
370 }
371
379 {
380 if (is_null($this->resourceUserProvidedIdentifiers)) {
382 $data = $this->raw(self::FIELD_RESOURCE_USER_PROVIDED_IDENTIFIERS);
383 if (is_null($data)) {
384 return null;
385 }
386
387 $this->resourceUserProvidedIdentifiers = UserProvidedIdentifiersModel::of($data);
388 }
389
391 }
392
399 public function getDeliveryId()
400 {
401 if (is_null($this->deliveryId)) {
403 $data = $this->raw(self::FIELD_DELIVERY_ID);
404 if (is_null($data)) {
405 return null;
406 }
407 $this->deliveryId = (string) $data;
408 }
409
410 return $this->deliveryId;
411 }
412
419 public function getParcelId()
420 {
421 if (is_null($this->parcelId)) {
423 $data = $this->raw(self::FIELD_PARCEL_ID);
424 if (is_null($data)) {
425 return null;
426 }
427 $this->parcelId = (string) $data;
428 }
429
430 return $this->parcelId;
431 }
432
439 public function getMeasurements()
440 {
441 if (is_null($this->measurements)) {
443 $data = $this->raw(self::FIELD_MEASUREMENTS);
444 if (is_null($data)) {
445 return null;
446 }
447
448 $this->measurements = ParcelMeasurementsModel::of($data);
449 }
450
451 return $this->measurements;
452 }
453
460 public function getShippingKey()
461 {
462 if (is_null($this->shippingKey)) {
464 $data = $this->raw(self::FIELD_SHIPPING_KEY);
465 if (is_null($data)) {
466 return null;
467 }
468 $this->shippingKey = (string) $data;
469 }
470
471 return $this->shippingKey;
472 }
473
474
478 public function setId(?string $id): void
479 {
480 $this->id = $id;
481 }
482
486 public function setVersion(?int $version): void
487 {
488 $this->version = $version;
489 }
490
494 public function setCreatedAt(?DateTimeImmutable $createdAt): void
495 {
496 $this->createdAt = $createdAt;
497 }
498
502 public function setLastModifiedAt(?DateTimeImmutable $lastModifiedAt): void
503 {
504 $this->lastModifiedAt = $lastModifiedAt;
505 }
506
511 {
512 $this->lastModifiedBy = $lastModifiedBy;
513 }
514
518 public function setCreatedBy(?CreatedBy $createdBy): void
519 {
520 $this->createdBy = $createdBy;
521 }
522
526 public function setSequenceNumber(?int $sequenceNumber): void
527 {
528 $this->sequenceNumber = $sequenceNumber;
529 }
530
534 public function setResource(?Reference $resource): void
535 {
536 $this->resource = $resource;
537 }
538
542 public function setResourceVersion(?int $resourceVersion): void
543 {
544 $this->resourceVersion = $resourceVersion;
545 }
546
551 {
552 $this->resourceUserProvidedIdentifiers = $resourceUserProvidedIdentifiers;
553 }
554
558 public function setDeliveryId(?string $deliveryId): void
559 {
560 $this->deliveryId = $deliveryId;
561 }
562
566 public function setParcelId(?string $parcelId): void
567 {
568 $this->parcelId = $parcelId;
569 }
570
575 {
576 $this->measurements = $measurements;
577 }
578
582 public function setShippingKey(?string $shippingKey): void
583 {
584 $this->shippingKey = $shippingKey;
585 }
586
587
588 #[\ReturnTypeWillChange]
589 public function jsonSerialize()
590 {
591 $data = $this->toArray();
592 if (isset($data[Message::FIELD_CREATED_AT]) && $data[Message::FIELD_CREATED_AT] instanceof \DateTimeImmutable) {
593 $data[Message::FIELD_CREATED_AT] = $data[Message::FIELD_CREATED_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c');
594 }
595
596 if (isset($data[Message::FIELD_LAST_MODIFIED_AT]) && $data[Message::FIELD_LAST_MODIFIED_AT] instanceof \DateTimeImmutable) {
597 $data[Message::FIELD_LAST_MODIFIED_AT] = $data[Message::FIELD_LAST_MODIFIED_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c');
598 }
599 return (object) $data;
600 }
601}
__construct(?string $id=null, ?int $version=null, ?DateTimeImmutable $createdAt=null, ?DateTimeImmutable $lastModifiedAt=null, ?LastModifiedBy $lastModifiedBy=null, ?CreatedBy $createdBy=null, ?int $sequenceNumber=null, ?Reference $resource=null, ?int $resourceVersion=null, ?UserProvidedIdentifiers $resourceUserProvidedIdentifiers=null, ?string $deliveryId=null, ?string $parcelId=null, ?ParcelMeasurements $measurements=null, ?string $shippingKey=null, ?string $type=null)
setResourceUserProvidedIdentifiers(?UserProvidedIdentifiers $resourceUserProvidedIdentifiers)