commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
MyCartDraftBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
27 use stdClass;
28 
32 final class MyCartDraftBuilder implements Builder
33 {
38  private $currency;
39 
44  private $customerEmail;
45 
50  private $businessUnit;
51 
56  private $store;
57 
62  private $lineItems;
63 
68  private $taxMode;
69 
74  private $inventoryMode;
75 
80  private $billingAddress;
81 
86  private $shippingAddress;
87 
92  private $shippingMethod;
93 
98  private $itemShippingAddresses;
99 
104  private $shippingMode;
105 
110  private $discountCodes;
111 
116  private $country;
117 
122  private $locale;
123 
128  private $deleteDaysAfterLastModification;
129 
134  private $custom;
135 
142  public function getCurrency()
143  {
144  return $this->currency;
145  }
146 
153  public function getCustomerEmail()
154  {
155  return $this->customerEmail;
156  }
157 
164  public function getBusinessUnit()
165  {
166  return $this->businessUnit instanceof BusinessUnitResourceIdentifierBuilder ? $this->businessUnit->build() : $this->businessUnit;
167  }
168 
175  public function getStore()
176  {
177  return $this->store instanceof StoreResourceIdentifierBuilder ? $this->store->build() : $this->store;
178  }
179 
186  public function getLineItems()
187  {
188  return $this->lineItems;
189  }
190 
197  public function getTaxMode()
198  {
199  return $this->taxMode;
200  }
201 
208  public function getInventoryMode()
209  {
210  return $this->inventoryMode;
211  }
212 
219  public function getBillingAddress()
220  {
221  return $this->billingAddress instanceof BaseAddressBuilder ? $this->billingAddress->build() : $this->billingAddress;
222  }
223 
230  public function getShippingAddress()
231  {
232  return $this->shippingAddress instanceof BaseAddressBuilder ? $this->shippingAddress->build() : $this->shippingAddress;
233  }
234 
241  public function getShippingMethod()
242  {
243  return $this->shippingMethod instanceof ShippingMethodResourceIdentifierBuilder ? $this->shippingMethod->build() : $this->shippingMethod;
244  }
245 
254  public function getItemShippingAddresses()
255  {
256  return $this->itemShippingAddresses;
257  }
258 
268  public function getShippingMode()
269  {
270  return $this->shippingMode;
271  }
272 
279  public function getDiscountCodes()
280  {
281  return $this->discountCodes;
282  }
283 
291  public function getCountry()
292  {
293  return $this->country;
294  }
295 
303  public function getLocale()
304  {
305  return $this->locale;
306  }
307 
317  {
318  return $this->deleteDaysAfterLastModification;
319  }
320 
327  public function getCustom()
328  {
329  return $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom;
330  }
331 
336  public function withCurrency(?string $currency)
337  {
338  $this->currency = $currency;
339 
340  return $this;
341  }
342 
347  public function withCustomerEmail(?string $customerEmail)
348  {
349  $this->customerEmail = $customerEmail;
350 
351  return $this;
352  }
353 
358  public function withBusinessUnit(?BusinessUnitResourceIdentifier $businessUnit)
359  {
360  $this->businessUnit = $businessUnit;
361 
362  return $this;
363  }
364 
369  public function withStore(?StoreResourceIdentifier $store)
370  {
371  $this->store = $store;
372 
373  return $this;
374  }
375 
380  public function withLineItems(?MyLineItemDraftCollection $lineItems)
381  {
382  $this->lineItems = $lineItems;
383 
384  return $this;
385  }
386 
391  public function withTaxMode(?string $taxMode)
392  {
393  $this->taxMode = $taxMode;
394 
395  return $this;
396  }
397 
402  public function withInventoryMode(?string $inventoryMode)
403  {
404  $this->inventoryMode = $inventoryMode;
405 
406  return $this;
407  }
408 
413  public function withBillingAddress(?BaseAddress $billingAddress)
414  {
415  $this->billingAddress = $billingAddress;
416 
417  return $this;
418  }
419 
424  public function withShippingAddress(?BaseAddress $shippingAddress)
425  {
426  $this->shippingAddress = $shippingAddress;
427 
428  return $this;
429  }
430 
435  public function withShippingMethod(?ShippingMethodResourceIdentifier $shippingMethod)
436  {
437  $this->shippingMethod = $shippingMethod;
438 
439  return $this;
440  }
441 
446  public function withItemShippingAddresses(?BaseAddressCollection $itemShippingAddresses)
447  {
448  $this->itemShippingAddresses = $itemShippingAddresses;
449 
450  return $this;
451  }
452 
457  public function withShippingMode(?string $shippingMode)
458  {
459  $this->shippingMode = $shippingMode;
460 
461  return $this;
462  }
463 
468  public function withDiscountCodes(?array $discountCodes)
469  {
470  $this->discountCodes = $discountCodes;
471 
472  return $this;
473  }
474 
479  public function withCountry(?string $country)
480  {
481  $this->country = $country;
482 
483  return $this;
484  }
485 
490  public function withLocale(?string $locale)
491  {
492  $this->locale = $locale;
493 
494  return $this;
495  }
496 
501  public function withDeleteDaysAfterLastModification(?int $deleteDaysAfterLastModification)
502  {
503  $this->deleteDaysAfterLastModification = $deleteDaysAfterLastModification;
504 
505  return $this;
506  }
507 
512  public function withCustom(?CustomFieldsDraft $custom)
513  {
514  $this->custom = $custom;
515 
516  return $this;
517  }
518 
524  {
525  $this->businessUnit = $businessUnit;
526 
527  return $this;
528  }
529 
535  {
536  $this->store = $store;
537 
538  return $this;
539  }
540 
545  public function withBillingAddressBuilder(?BaseAddressBuilder $billingAddress)
546  {
547  $this->billingAddress = $billingAddress;
548 
549  return $this;
550  }
551 
556  public function withShippingAddressBuilder(?BaseAddressBuilder $shippingAddress)
557  {
558  $this->shippingAddress = $shippingAddress;
559 
560  return $this;
561  }
562 
568  {
569  $this->shippingMethod = $shippingMethod;
570 
571  return $this;
572  }
573 
578  public function withCustomBuilder(?CustomFieldsDraftBuilder $custom)
579  {
580  $this->custom = $custom;
581 
582  return $this;
583  }
584 
585  public function build(): MyCartDraft
586  {
587  return new MyCartDraftModel(
588  $this->currency,
589  $this->customerEmail,
590  $this->businessUnit instanceof BusinessUnitResourceIdentifierBuilder ? $this->businessUnit->build() : $this->businessUnit,
591  $this->store instanceof StoreResourceIdentifierBuilder ? $this->store->build() : $this->store,
592  $this->lineItems,
593  $this->taxMode,
594  $this->inventoryMode,
595  $this->billingAddress instanceof BaseAddressBuilder ? $this->billingAddress->build() : $this->billingAddress,
596  $this->shippingAddress instanceof BaseAddressBuilder ? $this->shippingAddress->build() : $this->shippingAddress,
597  $this->shippingMethod instanceof ShippingMethodResourceIdentifierBuilder ? $this->shippingMethod->build() : $this->shippingMethod,
598  $this->itemShippingAddresses,
599  $this->shippingMode,
600  $this->discountCodes,
601  $this->country,
602  $this->locale,
603  $this->deleteDaysAfterLastModification,
604  $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom
605  );
606  }
607 
608  public static function of(): MyCartDraftBuilder
609  {
610  return new self();
611  }
612 }
withShippingAddressBuilder(?BaseAddressBuilder $shippingAddress)
withBusinessUnitBuilder(?BusinessUnitResourceIdentifierBuilder $businessUnit)
withShippingMethod(?ShippingMethodResourceIdentifier $shippingMethod)
withBillingAddressBuilder(?BaseAddressBuilder $billingAddress)
withStoreBuilder(?StoreResourceIdentifierBuilder $store)
withLineItems(?MyLineItemDraftCollection $lineItems)
withCustomBuilder(?CustomFieldsDraftBuilder $custom)
withBusinessUnit(?BusinessUnitResourceIdentifier $businessUnit)
withDeleteDaysAfterLastModification(?int $deleteDaysAfterLastModification)
withShippingAddress(?BaseAddress $shippingAddress)
withItemShippingAddresses(?BaseAddressCollection $itemShippingAddresses)
withShippingMethodBuilder(?ShippingMethodResourceIdentifierBuilder $shippingMethod)