commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
ParcelDraftModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
17 use stdClass;
18 
22 final class ParcelDraftModel extends JsonObjectModel implements ParcelDraft
23 {
28  protected $key;
29 
34  protected $measurements;
35 
40  protected $trackingData;
41 
46  protected $items;
47 
52  protected $custom;
53 
54 
58  public function __construct(
59  ?string $key = null,
64  ) {
65  $this->key = $key;
66  $this->measurements = $measurements;
67  $this->trackingData = $trackingData;
68  $this->items = $items;
69  $this->custom = $custom;
70  }
71 
78  public function getKey()
79  {
80  if (is_null($this->key)) {
82  $data = $this->raw(self::FIELD_KEY);
83  if (is_null($data)) {
84  return null;
85  }
86  $this->key = (string) $data;
87  }
88 
89  return $this->key;
90  }
91 
98  public function getMeasurements()
99  {
100  if (is_null($this->measurements)) {
102  $data = $this->raw(self::FIELD_MEASUREMENTS);
103  if (is_null($data)) {
104  return null;
105  }
106 
107  $this->measurements = ParcelMeasurementsModel::of($data);
108  }
109 
110  return $this->measurements;
111  }
112 
119  public function getTrackingData()
120  {
121  if (is_null($this->trackingData)) {
123  $data = $this->raw(self::FIELD_TRACKING_DATA);
124  if (is_null($data)) {
125  return null;
126  }
127 
128  $this->trackingData = TrackingDataModel::of($data);
129  }
130 
131  return $this->trackingData;
132  }
133 
140  public function getItems()
141  {
142  if (is_null($this->items)) {
144  $data = $this->raw(self::FIELD_ITEMS);
145  if (is_null($data)) {
146  return null;
147  }
148  $this->items = DeliveryItemCollection::fromArray($data);
149  }
150 
151  return $this->items;
152  }
153 
160  public function getCustom()
161  {
162  if (is_null($this->custom)) {
164  $data = $this->raw(self::FIELD_CUSTOM);
165  if (is_null($data)) {
166  return null;
167  }
168 
169  $this->custom = CustomFieldsDraftModel::of($data);
170  }
171 
172  return $this->custom;
173  }
174 
175 
179  public function setKey(?string $key): void
180  {
181  $this->key = $key;
182  }
183 
188  {
189  $this->measurements = $measurements;
190  }
191 
196  {
197  $this->trackingData = $trackingData;
198  }
199 
203  public function setItems(?DeliveryItemCollection $items): void
204  {
205  $this->items = $items;
206  }
207 
211  public function setCustom(?CustomFieldsDraft $custom): void
212  {
213  $this->custom = $custom;
214  }
215 }
__construct(?string $key=null, ?ParcelMeasurements $measurements=null, ?TrackingData $trackingData=null, ?DeliveryItemCollection $items=null, ?CustomFieldsDraft $custom=null)
setMeasurements(?ParcelMeasurements $measurements)