commercetools-sdk-php-v2  master
The platform, import-api and ml-api PHP sdks generated from our api reference.
DeliveryParcelModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
20 use stdClass;
21 
25 final class DeliveryParcelModel extends JsonObjectModel implements DeliveryParcel
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 
71  public function getDeliveryId()
72  {
73  if (is_null($this->deliveryId)) {
75  $data = $this->raw(self::FIELD_DELIVERY_ID);
76  if (is_null($data)) {
77  return null;
78  }
79  $this->deliveryId = (string) $data;
80  }
81 
82  return $this->deliveryId;
83  }
84 
89  public function getMeasurements()
90  {
91  if (is_null($this->measurements)) {
93  $data = $this->raw(self::FIELD_MEASUREMENTS);
94  if (is_null($data)) {
95  return null;
96  }
97 
98  $this->measurements = ParcelMeasurementsModel::of($data);
99  }
100 
101  return $this->measurements;
102  }
103 
108  public function getTrackingData()
109  {
110  if (is_null($this->trackingData)) {
112  $data = $this->raw(self::FIELD_TRACKING_DATA);
113  if (is_null($data)) {
114  return null;
115  }
116 
117  $this->trackingData = TrackingDataModel::of($data);
118  }
119 
120  return $this->trackingData;
121  }
122 
127  public function getItems()
128  {
129  if (is_null($this->items)) {
131  $data = $this->raw(self::FIELD_ITEMS);
132  if (is_null($data)) {
133  return null;
134  }
135  $this->items = DeliveryItemCollection::fromArray($data);
136  }
137 
138  return $this->items;
139  }
140 
141 
145  public function setDeliveryId(?string $deliveryId): void
146  {
147  $this->deliveryId = $deliveryId;
148  }
149 
154  {
155  $this->measurements = $measurements;
156  }
157 
162  {
163  $this->trackingData = $trackingData;
164  }
165 
169  public function setItems(?DeliveryItemCollection $items): void
170  {
171  $this->items = $items;
172  }
173 }
__construct(?string $deliveryId=null, ?ParcelMeasurements $measurements=null, ?TrackingData $trackingData=null, ?DeliveryItemCollection $items=null)