commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
All Classes Namespaces Functions Variables Pages
CustomShippingDraftBuilder.php
1<?php
2
3declare(strict_types=1);
10
25use stdClass;
26
30final class CustomShippingDraftBuilder implements Builder
31{
36 private $key;
37
42 private $shippingMethodName;
43
48 private $shippingAddress;
49
54 private $shippingRate;
55
60 private $shippingRateInput;
61
66 private $taxCategory;
67
72 private $externalTaxRate;
73
78 private $deliveries;
79
84 private $custom;
85
92 public function getKey()
93 {
94 return $this->key;
95 }
96
103 public function getShippingMethodName()
104 {
105 return $this->shippingMethodName;
106 }
107
114 public function getShippingAddress()
115 {
116 return $this->shippingAddress instanceof BaseAddressBuilder ? $this->shippingAddress->build() : $this->shippingAddress;
117 }
118
125 public function getShippingRate()
126 {
127 return $this->shippingRate instanceof ShippingRateDraftBuilder ? $this->shippingRate->build() : $this->shippingRate;
128 }
129
142 public function getShippingRateInput()
143 {
144 return $this->shippingRateInput instanceof ShippingRateInputDraftBuilder ? $this->shippingRateInput->build() : $this->shippingRateInput;
145 }
146
153 public function getTaxCategory()
154 {
155 return $this->taxCategory instanceof TaxCategoryResourceIdentifierBuilder ? $this->taxCategory->build() : $this->taxCategory;
156 }
157
164 public function getExternalTaxRate()
165 {
166 return $this->externalTaxRate instanceof ExternalTaxRateDraftBuilder ? $this->externalTaxRate->build() : $this->externalTaxRate;
167 }
168
175 public function getDeliveries()
176 {
177 return $this->deliveries;
178 }
179
186 public function getCustom()
187 {
188 return $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom;
189 }
190
195 public function withKey(?string $key)
196 {
197 $this->key = $key;
198
199 return $this;
200 }
201
206 public function withShippingMethodName(?string $shippingMethodName)
207 {
208 $this->shippingMethodName = $shippingMethodName;
209
210 return $this;
211 }
212
217 public function withShippingAddress(?BaseAddress $shippingAddress)
218 {
219 $this->shippingAddress = $shippingAddress;
220
221 return $this;
222 }
223
228 public function withShippingRate(?ShippingRateDraft $shippingRate)
229 {
230 $this->shippingRate = $shippingRate;
231
232 return $this;
233 }
234
239 public function withShippingRateInput(?ShippingRateInputDraft $shippingRateInput)
240 {
241 $this->shippingRateInput = $shippingRateInput;
242
243 return $this;
244 }
245
250 public function withTaxCategory(?TaxCategoryResourceIdentifier $taxCategory)
251 {
252 $this->taxCategory = $taxCategory;
253
254 return $this;
255 }
256
261 public function withExternalTaxRate(?ExternalTaxRateDraft $externalTaxRate)
262 {
263 $this->externalTaxRate = $externalTaxRate;
264
265 return $this;
266 }
267
272 public function withDeliveries(?DeliveryDraftCollection $deliveries)
273 {
274 $this->deliveries = $deliveries;
275
276 return $this;
277 }
278
283 public function withCustom(?CustomFieldsDraft $custom)
284 {
285 $this->custom = $custom;
286
287 return $this;
288 }
289
294 public function withShippingAddressBuilder(?BaseAddressBuilder $shippingAddress)
295 {
296 $this->shippingAddress = $shippingAddress;
297
298 return $this;
299 }
300
305 public function withShippingRateBuilder(?ShippingRateDraftBuilder $shippingRate)
306 {
307 $this->shippingRate = $shippingRate;
308
309 return $this;
310 }
311
317 {
318 $this->shippingRateInput = $shippingRateInput;
319
320 return $this;
321 }
322
328 {
329 $this->taxCategory = $taxCategory;
330
331 return $this;
332 }
333
339 {
340 $this->externalTaxRate = $externalTaxRate;
341
342 return $this;
343 }
344
350 {
351 $this->custom = $custom;
352
353 return $this;
354 }
355
356 public function build(): CustomShippingDraft
357 {
358 return new CustomShippingDraftModel(
359 $this->key,
360 $this->shippingMethodName,
361 $this->shippingAddress instanceof BaseAddressBuilder ? $this->shippingAddress->build() : $this->shippingAddress,
362 $this->shippingRate instanceof ShippingRateDraftBuilder ? $this->shippingRate->build() : $this->shippingRate,
363 $this->shippingRateInput instanceof ShippingRateInputDraftBuilder ? $this->shippingRateInput->build() : $this->shippingRateInput,
364 $this->taxCategory instanceof TaxCategoryResourceIdentifierBuilder ? $this->taxCategory->build() : $this->taxCategory,
365 $this->externalTaxRate instanceof ExternalTaxRateDraftBuilder ? $this->externalTaxRate->build() : $this->externalTaxRate,
366 $this->deliveries,
367 $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom
368 );
369 }
370
371 public static function of(): CustomShippingDraftBuilder
372 {
373 return new self();
374 }
375}
withExternalTaxRateBuilder(?ExternalTaxRateDraftBuilder $externalTaxRate)
withTaxCategory(?TaxCategoryResourceIdentifier $taxCategory)
withShippingRateInput(?ShippingRateInputDraft $shippingRateInput)
withShippingRateInputBuilder(?ShippingRateInputDraftBuilder $shippingRateInput)
withTaxCategoryBuilder(?TaxCategoryResourceIdentifierBuilder $taxCategory)