commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
DeliveryParcelModel.php
1<?php
2
3declare(strict_types=1);
10
20use stdClass;
21
26{
31 protected $deliveryId;
32
37 protected $measurements;
38
43 protected $trackingData;
44
49 protected $items;
50
51
55 public function __construct(
56 ?string $deliveryId = null,
60 ) {
61 $this->deliveryId = $deliveryId;
62 $this->measurements = $measurements;
63 $this->trackingData = $trackingData;
64 $this->items = $items;
65 }
66
73 public function getDeliveryId()
74 {
75 if (is_null($this->deliveryId)) {
77 $data = $this->raw(self::FIELD_DELIVERY_ID);
78 if (is_null($data)) {
79 return null;
80 }
81 $this->deliveryId = (string) $data;
82 }
83
84 return $this->deliveryId;
85 }
86
93 public function getMeasurements()
94 {
95 if (is_null($this->measurements)) {
97 $data = $this->raw(self::FIELD_MEASUREMENTS);
98 if (is_null($data)) {
99 return null;
100 }
101
102 $this->measurements = ParcelMeasurementsModel::of($data);
103 }
104
105 return $this->measurements;
106 }
107
114 public function getTrackingData()
115 {
116 if (is_null($this->trackingData)) {
118 $data = $this->raw(self::FIELD_TRACKING_DATA);
119 if (is_null($data)) {
120 return null;
121 }
122
123 $this->trackingData = TrackingDataModel::of($data);
124 }
125
126 return $this->trackingData;
127 }
128
135 public function getItems()
136 {
137 if (is_null($this->items)) {
139 $data = $this->raw(self::FIELD_ITEMS);
140 if (is_null($data)) {
141 return null;
142 }
143 $this->items = DeliveryItemCollection::fromArray($data);
144 }
145
146 return $this->items;
147 }
148
149
153 public function setDeliveryId(?string $deliveryId): void
154 {
155 $this->deliveryId = $deliveryId;
156 }
157
162 {
163 $this->measurements = $measurements;
164 }
165
170 {
171 $this->trackingData = $trackingData;
172 }
173
177 public function setItems(?DeliveryItemCollection $items): void
178 {
179 $this->items = $items;
180 }
181}
__construct(?string $deliveryId=null, ?ParcelMeasurements $measurements=null, ?TrackingData $trackingData=null, ?DeliveryItemCollection $items=null)