commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
DeliveryParcelDraftModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
20 use stdClass;
21 
26 {
31  protected $measurements;
32 
37  protected $trackingData;
38 
43  protected $items;
44 
45 
49  public function __construct(
53  ) {
54  $this->measurements = $measurements;
55  $this->trackingData = $trackingData;
56  $this->items = $items;
57  }
58 
63  public function getMeasurements()
64  {
65  if (is_null($this->measurements)) {
67  $data = $this->raw(self::FIELD_MEASUREMENTS);
68  if (is_null($data)) {
69  return null;
70  }
71 
72  $this->measurements = ParcelMeasurementsModel::of($data);
73  }
74 
75  return $this->measurements;
76  }
77 
82  public function getTrackingData()
83  {
84  if (is_null($this->trackingData)) {
86  $data = $this->raw(self::FIELD_TRACKING_DATA);
87  if (is_null($data)) {
88  return null;
89  }
90 
91  $this->trackingData = TrackingDataModel::of($data);
92  }
93 
94  return $this->trackingData;
95  }
96 
101  public function getItems()
102  {
103  if (is_null($this->items)) {
105  $data = $this->raw(self::FIELD_ITEMS);
106  if (is_null($data)) {
107  return null;
108  }
109  $this->items = DeliveryItemCollection::fromArray($data);
110  }
111 
112  return $this->items;
113  }
114 
115 
120  {
121  $this->measurements = $measurements;
122  }
123 
128  {
129  $this->trackingData = $trackingData;
130  }
131 
135  public function setItems(?DeliveryItemCollection $items): void
136  {
137  $this->items = $items;
138  }
139 }
__construct(?ParcelMeasurements $measurements=null, ?TrackingData $trackingData=null, ?DeliveryItemCollection $items=null)