commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
ParcelItemsModel.php
1<?php
2
3declare(strict_types=1);
10
16use stdClass;
17
21final class ParcelItemsModel extends JsonObjectModel implements ParcelItems
22{
27 protected $parcelId;
28
33 protected $items;
34
35
39 public function __construct(
40 ?string $parcelId = null,
42 ) {
43 $this->parcelId = $parcelId;
44 $this->items = $items;
45 }
46
53 public function getParcelId()
54 {
55 if (is_null($this->parcelId)) {
57 $data = $this->raw(self::FIELD_PARCEL_ID);
58 if (is_null($data)) {
59 return null;
60 }
61 $this->parcelId = (string) $data;
62 }
63
64 return $this->parcelId;
65 }
66
73 public function getItems()
74 {
75 if (is_null($this->items)) {
77 $data = $this->raw(self::FIELD_ITEMS);
78 if (is_null($data)) {
79 return null;
80 }
81 $this->items = DeliveryItemCollection::fromArray($data);
82 }
83
84 return $this->items;
85 }
86
87
91 public function setParcelId(?string $parcelId): void
92 {
93 $this->parcelId = $parcelId;
94 }
95
99 public function setItems(?DeliveryItemCollection $items): void
100 {
101 $this->items = $items;
102 }
103}
__construct(?string $parcelId=null, ?DeliveryItemCollection $items=null)