commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
CustomerBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
28 use DateTimeImmutable;
29 use stdClass;
30 
34 final class CustomerBuilder implements Builder
35 {
40  private $id;
41 
46  private $version;
47 
52  private $createdAt;
53 
58  private $lastModifiedAt;
59 
64  private $key;
65 
70  private $customerNumber;
71 
76  private $externalId;
77 
82  private $lastModifiedBy;
83 
88  private $createdBy;
89 
94  private $email;
95 
100  private $password;
101 
106  private $firstName;
107 
112  private $lastName;
113 
118  private $middleName;
119 
124  private $title;
125 
130  private $dateOfBirth;
131 
136  private $companyName;
137 
142  private $vatId;
143 
148  private $addresses;
149 
154  private $defaultShippingAddressId;
155 
160  private $shippingAddressIds;
161 
166  private $defaultBillingAddressId;
167 
172  private $billingAddressIds;
173 
178  private $isEmailVerified;
179 
184  private $customerGroup;
185 
190  private $custom;
191 
196  private $locale;
197 
202  private $salutation;
203 
208  private $stores;
209 
214  private $authenticationMode;
215 
222  public function getId()
223  {
224  return $this->id;
225  }
226 
233  public function getVersion()
234  {
235  return $this->version;
236  }
237 
244  public function getCreatedAt()
245  {
246  return $this->createdAt;
247  }
248 
255  public function getLastModifiedAt()
256  {
257  return $this->lastModifiedAt;
258  }
259 
266  public function getKey()
267  {
268  return $this->key;
269  }
270 
278  public function getCustomerNumber()
279  {
280  return $this->customerNumber;
281  }
282 
289  public function getExternalId()
290  {
291  return $this->externalId;
292  }
293 
300  public function getLastModifiedBy()
301  {
302  return $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy;
303  }
304 
311  public function getCreatedBy()
312  {
313  return $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy;
314  }
315 
323  public function getEmail()
324  {
325  return $this->email;
326  }
327 
334  public function getPassword()
335  {
336  return $this->password;
337  }
338 
345  public function getFirstName()
346  {
347  return $this->firstName;
348  }
349 
356  public function getLastName()
357  {
358  return $this->lastName;
359  }
360 
367  public function getMiddleName()
368  {
369  return $this->middleName;
370  }
371 
378  public function getTitle()
379  {
380  return $this->title;
381  }
382 
389  public function getDateOfBirth()
390  {
391  return $this->dateOfBirth;
392  }
393 
400  public function getCompanyName()
401  {
402  return $this->companyName;
403  }
404 
411  public function getVatId()
412  {
413  return $this->vatId;
414  }
415 
422  public function getAddresses()
423  {
424  return $this->addresses;
425  }
426 
433  public function getDefaultShippingAddressId()
434  {
435  return $this->defaultShippingAddressId;
436  }
437 
444  public function getShippingAddressIds()
445  {
446  return $this->shippingAddressIds;
447  }
448 
455  public function getDefaultBillingAddressId()
456  {
457  return $this->defaultBillingAddressId;
458  }
459 
466  public function getBillingAddressIds()
467  {
468  return $this->billingAddressIds;
469  }
470 
477  public function getIsEmailVerified()
478  {
479  return $this->isEmailVerified;
480  }
481 
488  public function getCustomerGroup()
489  {
490  return $this->customerGroup instanceof CustomerGroupReferenceBuilder ? $this->customerGroup->build() : $this->customerGroup;
491  }
492 
499  public function getCustom()
500  {
501  return $this->custom instanceof CustomFieldsBuilder ? $this->custom->build() : $this->custom;
502  }
503 
510  public function getLocale()
511  {
512  return $this->locale;
513  }
514 
521  public function getSalutation()
522  {
523  return $this->salutation;
524  }
525 
536  public function getStores()
537  {
538  return $this->stores;
539  }
540 
547  public function getAuthenticationMode()
548  {
549  return $this->authenticationMode;
550  }
551 
556  public function withId(?string $id)
557  {
558  $this->id = $id;
559 
560  return $this;
561  }
562 
567  public function withVersion(?int $version)
568  {
569  $this->version = $version;
570 
571  return $this;
572  }
573 
578  public function withCreatedAt(?DateTimeImmutable $createdAt)
579  {
580  $this->createdAt = $createdAt;
581 
582  return $this;
583  }
584 
589  public function withLastModifiedAt(?DateTimeImmutable $lastModifiedAt)
590  {
591  $this->lastModifiedAt = $lastModifiedAt;
592 
593  return $this;
594  }
595 
600  public function withKey(?string $key)
601  {
602  $this->key = $key;
603 
604  return $this;
605  }
606 
611  public function withCustomerNumber(?string $customerNumber)
612  {
613  $this->customerNumber = $customerNumber;
614 
615  return $this;
616  }
617 
622  public function withExternalId(?string $externalId)
623  {
624  $this->externalId = $externalId;
625 
626  return $this;
627  }
628 
633  public function withLastModifiedBy(?LastModifiedBy $lastModifiedBy)
634  {
635  $this->lastModifiedBy = $lastModifiedBy;
636 
637  return $this;
638  }
639 
644  public function withCreatedBy(?CreatedBy $createdBy)
645  {
646  $this->createdBy = $createdBy;
647 
648  return $this;
649  }
650 
655  public function withEmail(?string $email)
656  {
657  $this->email = $email;
658 
659  return $this;
660  }
661 
666  public function withPassword(?string $password)
667  {
668  $this->password = $password;
669 
670  return $this;
671  }
672 
677  public function withFirstName(?string $firstName)
678  {
679  $this->firstName = $firstName;
680 
681  return $this;
682  }
683 
688  public function withLastName(?string $lastName)
689  {
690  $this->lastName = $lastName;
691 
692  return $this;
693  }
694 
699  public function withMiddleName(?string $middleName)
700  {
701  $this->middleName = $middleName;
702 
703  return $this;
704  }
705 
710  public function withTitle(?string $title)
711  {
712  $this->title = $title;
713 
714  return $this;
715  }
716 
721  public function withDateOfBirth(?DateTimeImmutable $dateOfBirth)
722  {
723  $this->dateOfBirth = $dateOfBirth;
724 
725  return $this;
726  }
727 
732  public function withCompanyName(?string $companyName)
733  {
734  $this->companyName = $companyName;
735 
736  return $this;
737  }
738 
743  public function withVatId(?string $vatId)
744  {
745  $this->vatId = $vatId;
746 
747  return $this;
748  }
749 
754  public function withAddresses(?AddressCollection $addresses)
755  {
756  $this->addresses = $addresses;
757 
758  return $this;
759  }
760 
765  public function withDefaultShippingAddressId(?string $defaultShippingAddressId)
766  {
767  $this->defaultShippingAddressId = $defaultShippingAddressId;
768 
769  return $this;
770  }
771 
776  public function withShippingAddressIds(?array $shippingAddressIds)
777  {
778  $this->shippingAddressIds = $shippingAddressIds;
779 
780  return $this;
781  }
782 
787  public function withDefaultBillingAddressId(?string $defaultBillingAddressId)
788  {
789  $this->defaultBillingAddressId = $defaultBillingAddressId;
790 
791  return $this;
792  }
793 
798  public function withBillingAddressIds(?array $billingAddressIds)
799  {
800  $this->billingAddressIds = $billingAddressIds;
801 
802  return $this;
803  }
804 
809  public function withIsEmailVerified(?bool $isEmailVerified)
810  {
811  $this->isEmailVerified = $isEmailVerified;
812 
813  return $this;
814  }
815 
820  public function withCustomerGroup(?CustomerGroupReference $customerGroup)
821  {
822  $this->customerGroup = $customerGroup;
823 
824  return $this;
825  }
826 
831  public function withCustom(?CustomFields $custom)
832  {
833  $this->custom = $custom;
834 
835  return $this;
836  }
837 
842  public function withLocale(?string $locale)
843  {
844  $this->locale = $locale;
845 
846  return $this;
847  }
848 
853  public function withSalutation(?string $salutation)
854  {
855  $this->salutation = $salutation;
856 
857  return $this;
858  }
859 
864  public function withStores(?StoreKeyReferenceCollection $stores)
865  {
866  $this->stores = $stores;
867 
868  return $this;
869  }
870 
875  public function withAuthenticationMode(?string $authenticationMode)
876  {
877  $this->authenticationMode = $authenticationMode;
878 
879  return $this;
880  }
881 
886  public function withLastModifiedByBuilder(?LastModifiedByBuilder $lastModifiedBy)
887  {
888  $this->lastModifiedBy = $lastModifiedBy;
889 
890  return $this;
891  }
892 
897  public function withCreatedByBuilder(?CreatedByBuilder $createdBy)
898  {
899  $this->createdBy = $createdBy;
900 
901  return $this;
902  }
903 
909  {
910  $this->customerGroup = $customerGroup;
911 
912  return $this;
913  }
914 
919  public function withCustomBuilder(?CustomFieldsBuilder $custom)
920  {
921  $this->custom = $custom;
922 
923  return $this;
924  }
925 
926  public function build(): Customer
927  {
928  return new CustomerModel(
929  $this->id,
930  $this->version,
931  $this->createdAt,
932  $this->lastModifiedAt,
933  $this->key,
934  $this->customerNumber,
935  $this->externalId,
936  $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy,
937  $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy,
938  $this->email,
939  $this->password,
940  $this->firstName,
941  $this->lastName,
942  $this->middleName,
943  $this->title,
944  $this->dateOfBirth,
945  $this->companyName,
946  $this->vatId,
947  $this->addresses,
948  $this->defaultShippingAddressId,
949  $this->shippingAddressIds,
950  $this->defaultBillingAddressId,
951  $this->billingAddressIds,
952  $this->isEmailVerified,
953  $this->customerGroup instanceof CustomerGroupReferenceBuilder ? $this->customerGroup->build() : $this->customerGroup,
954  $this->custom instanceof CustomFieldsBuilder ? $this->custom->build() : $this->custom,
955  $this->locale,
956  $this->salutation,
957  $this->stores,
958  $this->authenticationMode
959  );
960  }
961 
962  public static function of(): CustomerBuilder
963  {
964  return new self();
965  }
966 }
withCustomerGroupBuilder(?CustomerGroupReferenceBuilder $customerGroup)
withCreatedByBuilder(?CreatedByBuilder $createdBy)
withDefaultShippingAddressId(?string $defaultShippingAddressId)
withDefaultBillingAddressId(?string $defaultBillingAddressId)
withLastModifiedBy(?LastModifiedBy $lastModifiedBy)
withDateOfBirth(?DateTimeImmutable $dateOfBirth)
withCustomerGroup(?CustomerGroupReference $customerGroup)
withLastModifiedByBuilder(?LastModifiedByBuilder $lastModifiedBy)
withStores(?StoreKeyReferenceCollection $stores)
withLastModifiedAt(?DateTimeImmutable $lastModifiedAt)