commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
BusinessUnitBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
26 use DateTimeImmutable;
27 use stdClass;
28 
32 final class BusinessUnitBuilder implements Builder
33 {
38  private $id;
39 
44  private $version;
45 
50  private $createdAt;
51 
56  private $lastModifiedAt;
57 
62  private $lastModifiedBy;
63 
68  private $createdBy;
69 
74  private $key;
75 
80  private $status;
81 
86  private $stores;
87 
92  private $storeMode;
93 
98  private $name;
99 
104  private $contactEmail;
105 
110  private $custom;
111 
116  private $addresses;
117 
122  private $shippingAddressIds;
123 
128  private $defaultShippingAddressId;
129 
134  private $billingAddressIds;
135 
140  private $defaultBillingAddressId;
141 
146  private $associateMode;
147 
152  private $associates;
153 
158  private $inheritedAssociates;
159 
164  private $parentUnit;
165 
170  private $topLevelUnit;
171 
176  private $approvalRuleMode;
177 
184  public function getId()
185  {
186  return $this->id;
187  }
188 
195  public function getVersion()
196  {
197  return $this->version;
198  }
199 
206  public function getCreatedAt()
207  {
208  return $this->createdAt;
209  }
210 
217  public function getLastModifiedAt()
218  {
219  return $this->lastModifiedAt;
220  }
221 
228  public function getLastModifiedBy()
229  {
230  return $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy;
231  }
232 
239  public function getCreatedBy()
240  {
241  return $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy;
242  }
243 
250  public function getKey()
251  {
252  return $this->key;
253  }
254 
261  public function getStatus()
262  {
263  return $this->status;
264  }
265 
274  public function getStores()
275  {
276  return $this->stores;
277  }
278 
285  public function getStoreMode()
286  {
287  return $this->storeMode;
288  }
289 
296  public function getName()
297  {
298  return $this->name;
299  }
300 
307  public function getContactEmail()
308  {
309  return $this->contactEmail;
310  }
311 
318  public function getCustom()
319  {
320  return $this->custom instanceof CustomFieldsBuilder ? $this->custom->build() : $this->custom;
321  }
322 
329  public function getAddresses()
330  {
331  return $this->addresses;
332  }
333 
340  public function getShippingAddressIds()
341  {
342  return $this->shippingAddressIds;
343  }
344 
351  public function getDefaultShippingAddressId()
352  {
353  return $this->defaultShippingAddressId;
354  }
355 
362  public function getBillingAddressIds()
363  {
364  return $this->billingAddressIds;
365  }
366 
373  public function getDefaultBillingAddressId()
374  {
375  return $this->defaultBillingAddressId;
376  }
377 
384  public function getAssociateMode()
385  {
386  return $this->associateMode;
387  }
388 
395  public function getAssociates()
396  {
397  return $this->associates;
398  }
399 
406  public function getInheritedAssociates()
407  {
408  return $this->inheritedAssociates;
409  }
410 
417  public function getParentUnit()
418  {
419  return $this->parentUnit instanceof BusinessUnitKeyReferenceBuilder ? $this->parentUnit->build() : $this->parentUnit;
420  }
421 
428  public function getTopLevelUnit()
429  {
430  return $this->topLevelUnit instanceof BusinessUnitKeyReferenceBuilder ? $this->topLevelUnit->build() : $this->topLevelUnit;
431  }
432 
440  public function getApprovalRuleMode()
441  {
442  return $this->approvalRuleMode;
443  }
444 
449  public function withId(?string $id)
450  {
451  $this->id = $id;
452 
453  return $this;
454  }
455 
460  public function withVersion(?int $version)
461  {
462  $this->version = $version;
463 
464  return $this;
465  }
466 
471  public function withCreatedAt(?DateTimeImmutable $createdAt)
472  {
473  $this->createdAt = $createdAt;
474 
475  return $this;
476  }
477 
482  public function withLastModifiedAt(?DateTimeImmutable $lastModifiedAt)
483  {
484  $this->lastModifiedAt = $lastModifiedAt;
485 
486  return $this;
487  }
488 
493  public function withLastModifiedBy(?LastModifiedBy $lastModifiedBy)
494  {
495  $this->lastModifiedBy = $lastModifiedBy;
496 
497  return $this;
498  }
499 
504  public function withCreatedBy(?CreatedBy $createdBy)
505  {
506  $this->createdBy = $createdBy;
507 
508  return $this;
509  }
510 
515  public function withKey(?string $key)
516  {
517  $this->key = $key;
518 
519  return $this;
520  }
521 
526  public function withStatus(?string $status)
527  {
528  $this->status = $status;
529 
530  return $this;
531  }
532 
537  public function withStores(?StoreKeyReferenceCollection $stores)
538  {
539  $this->stores = $stores;
540 
541  return $this;
542  }
543 
548  public function withStoreMode(?string $storeMode)
549  {
550  $this->storeMode = $storeMode;
551 
552  return $this;
553  }
554 
559  public function withName(?string $name)
560  {
561  $this->name = $name;
562 
563  return $this;
564  }
565 
570  public function withContactEmail(?string $contactEmail)
571  {
572  $this->contactEmail = $contactEmail;
573 
574  return $this;
575  }
576 
581  public function withCustom(?CustomFields $custom)
582  {
583  $this->custom = $custom;
584 
585  return $this;
586  }
587 
592  public function withAddresses(?AddressCollection $addresses)
593  {
594  $this->addresses = $addresses;
595 
596  return $this;
597  }
598 
603  public function withShippingAddressIds(?array $shippingAddressIds)
604  {
605  $this->shippingAddressIds = $shippingAddressIds;
606 
607  return $this;
608  }
609 
614  public function withDefaultShippingAddressId(?string $defaultShippingAddressId)
615  {
616  $this->defaultShippingAddressId = $defaultShippingAddressId;
617 
618  return $this;
619  }
620 
625  public function withBillingAddressIds(?array $billingAddressIds)
626  {
627  $this->billingAddressIds = $billingAddressIds;
628 
629  return $this;
630  }
631 
636  public function withDefaultBillingAddressId(?string $defaultBillingAddressId)
637  {
638  $this->defaultBillingAddressId = $defaultBillingAddressId;
639 
640  return $this;
641  }
642 
647  public function withAssociateMode(?string $associateMode)
648  {
649  $this->associateMode = $associateMode;
650 
651  return $this;
652  }
653 
658  public function withAssociates(?AssociateCollection $associates)
659  {
660  $this->associates = $associates;
661 
662  return $this;
663  }
664 
669  public function withInheritedAssociates(?InheritedAssociateCollection $inheritedAssociates)
670  {
671  $this->inheritedAssociates = $inheritedAssociates;
672 
673  return $this;
674  }
675 
680  public function withParentUnit(?BusinessUnitKeyReference $parentUnit)
681  {
682  $this->parentUnit = $parentUnit;
683 
684  return $this;
685  }
686 
691  public function withTopLevelUnit(?BusinessUnitKeyReference $topLevelUnit)
692  {
693  $this->topLevelUnit = $topLevelUnit;
694 
695  return $this;
696  }
697 
702  public function withApprovalRuleMode(?string $approvalRuleMode)
703  {
704  $this->approvalRuleMode = $approvalRuleMode;
705 
706  return $this;
707  }
708 
713  public function withLastModifiedByBuilder(?LastModifiedByBuilder $lastModifiedBy)
714  {
715  $this->lastModifiedBy = $lastModifiedBy;
716 
717  return $this;
718  }
719 
724  public function withCreatedByBuilder(?CreatedByBuilder $createdBy)
725  {
726  $this->createdBy = $createdBy;
727 
728  return $this;
729  }
730 
735  public function withCustomBuilder(?CustomFieldsBuilder $custom)
736  {
737  $this->custom = $custom;
738 
739  return $this;
740  }
741 
747  {
748  $this->parentUnit = $parentUnit;
749 
750  return $this;
751  }
752 
758  {
759  $this->topLevelUnit = $topLevelUnit;
760 
761  return $this;
762  }
763 
764  public function build(): BusinessUnit
765  {
766  return new BusinessUnitModel(
767  $this->id,
768  $this->version,
769  $this->createdAt,
770  $this->lastModifiedAt,
771  $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy,
772  $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy,
773  $this->key,
774  $this->status,
775  $this->stores,
776  $this->storeMode,
777  $this->name,
778  $this->contactEmail,
779  $this->custom instanceof CustomFieldsBuilder ? $this->custom->build() : $this->custom,
780  $this->addresses,
781  $this->shippingAddressIds,
782  $this->defaultShippingAddressId,
783  $this->billingAddressIds,
784  $this->defaultBillingAddressId,
785  $this->associateMode,
786  $this->associates,
787  $this->inheritedAssociates,
788  $this->parentUnit instanceof BusinessUnitKeyReferenceBuilder ? $this->parentUnit->build() : $this->parentUnit,
789  $this->topLevelUnit instanceof BusinessUnitKeyReferenceBuilder ? $this->topLevelUnit->build() : $this->topLevelUnit,
790  $this->approvalRuleMode
791  );
792  }
793 
794  public static function of(): BusinessUnitBuilder
795  {
796  return new self();
797  }
798 }
withInheritedAssociates(?InheritedAssociateCollection $inheritedAssociates)
withLastModifiedByBuilder(?LastModifiedByBuilder $lastModifiedBy)
withTopLevelUnit(?BusinessUnitKeyReference $topLevelUnit)
withTopLevelUnitBuilder(?BusinessUnitKeyReferenceBuilder $topLevelUnit)
withParentUnitBuilder(?BusinessUnitKeyReferenceBuilder $parentUnit)