commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
DeliveryParcelDraftBuilder.php
1<?php
2
3declare(strict_types=1);
10
21use stdClass;
22
26final class DeliveryParcelDraftBuilder implements Builder
27{
32 private $measurements;
33
38 private $trackingData;
39
44 private $items;
45
52 public function getMeasurements()
53 {
54 return $this->measurements instanceof ParcelMeasurementsBuilder ? $this->measurements->build() : $this->measurements;
55 }
56
63 public function getTrackingData()
64 {
65 return $this->trackingData instanceof TrackingDataBuilder ? $this->trackingData->build() : $this->trackingData;
66 }
67
74 public function getItems()
75 {
76 return $this->items;
77 }
78
83 public function withMeasurements(?ParcelMeasurements $measurements)
84 {
85 $this->measurements = $measurements;
86
87 return $this;
88 }
89
94 public function withTrackingData(?TrackingData $trackingData)
95 {
96 $this->trackingData = $trackingData;
97
98 return $this;
99 }
100
105 public function withItems(?DeliveryItemCollection $items)
106 {
107 $this->items = $items;
108
109 return $this;
110 }
111
117 {
118 $this->measurements = $measurements;
119
120 return $this;
121 }
122
127 public function withTrackingDataBuilder(?TrackingDataBuilder $trackingData)
128 {
129 $this->trackingData = $trackingData;
130
131 return $this;
132 }
133
134 public function build(): DeliveryParcelDraft
135 {
136 return new DeliveryParcelDraftModel(
137 $this->measurements instanceof ParcelMeasurementsBuilder ? $this->measurements->build() : $this->measurements,
138 $this->trackingData instanceof TrackingDataBuilder ? $this->trackingData->build() : $this->trackingData,
139 $this->items
140 );
141 }
142
143 public static function of(): DeliveryParcelDraftBuilder
144 {
145 return new self();
146 }
147}