commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
DiscountCodeBuilder.php
1<?php
2
3declare(strict_types=1);
10
29use DateTimeImmutable;
30use stdClass;
31
35final class DiscountCodeBuilder implements Builder
36{
41 private $id;
42
47 private $version;
48
53 private $createdAt;
54
59 private $lastModifiedAt;
60
65 private $key;
66
71 private $lastModifiedBy;
72
77 private $createdBy;
78
83 private $name;
84
89 private $description;
90
95 private $code;
96
101 private $cartDiscounts;
102
107 private $stores;
108
113 private $cartPredicate;
114
119 private $isActive;
120
125 private $references;
126
131 private $maxApplications;
132
137 private $maxApplicationsPerCustomer;
138
143 private $custom;
144
149 private $groups;
150
155 private $validFrom;
156
161 private $validUntil;
162
167 private $applicationVersion;
168
175 public function getId()
176 {
177 return $this->id;
178 }
179
186 public function getVersion()
187 {
188 return $this->version;
189 }
190
197 public function getCreatedAt()
198 {
199 return $this->createdAt;
200 }
201
208 public function getLastModifiedAt()
209 {
210 return $this->lastModifiedAt;
211 }
212
219 public function getKey()
220 {
221 return $this->key;
222 }
223
230 public function getLastModifiedBy()
231 {
232 return $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy;
233 }
234
241 public function getCreatedBy()
242 {
243 return $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy;
244 }
245
252 public function getName()
253 {
254 return $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name;
255 }
256
263 public function getDescription()
264 {
265 return $this->description instanceof LocalizedStringBuilder ? $this->description->build() : $this->description;
266 }
267
274 public function getCode()
275 {
276 return $this->code;
277 }
278
285 public function getCartDiscounts()
286 {
287 return $this->cartDiscounts;
288 }
289
297 public function getStores()
298 {
299 return $this->stores;
300 }
301
308 public function getCartPredicate()
309 {
310 return $this->cartPredicate;
311 }
312
319 public function getIsActive()
320 {
321 return $this->isActive;
322 }
323
331 public function getReferences()
332 {
333 return $this->references;
334 }
335
345 public function getMaxApplications()
346 {
347 return $this->maxApplications;
348 }
349
360 {
361 return $this->maxApplicationsPerCustomer;
362 }
363
370 public function getCustom()
371 {
372 return $this->custom instanceof CustomFieldsBuilder ? $this->custom->build() : $this->custom;
373 }
374
381 public function getGroups()
382 {
383 return $this->groups;
384 }
385
392 public function getValidFrom()
393 {
394 return $this->validFrom;
395 }
396
403 public function getValidUntil()
404 {
405 return $this->validUntil;
406 }
407
415 public function getApplicationVersion()
416 {
417 return $this->applicationVersion;
418 }
419
424 public function withId(?string $id)
425 {
426 $this->id = $id;
427
428 return $this;
429 }
430
435 public function withVersion(?int $version)
436 {
437 $this->version = $version;
438
439 return $this;
440 }
441
446 public function withCreatedAt(?DateTimeImmutable $createdAt)
447 {
448 $this->createdAt = $createdAt;
449
450 return $this;
451 }
452
457 public function withLastModifiedAt(?DateTimeImmutable $lastModifiedAt)
458 {
459 $this->lastModifiedAt = $lastModifiedAt;
460
461 return $this;
462 }
463
468 public function withKey(?string $key)
469 {
470 $this->key = $key;
471
472 return $this;
473 }
474
479 public function withLastModifiedBy(?LastModifiedBy $lastModifiedBy)
480 {
481 $this->lastModifiedBy = $lastModifiedBy;
482
483 return $this;
484 }
485
490 public function withCreatedBy(?CreatedBy $createdBy)
491 {
492 $this->createdBy = $createdBy;
493
494 return $this;
495 }
496
501 public function withName(?LocalizedString $name)
502 {
503 $this->name = $name;
504
505 return $this;
506 }
507
512 public function withDescription(?LocalizedString $description)
513 {
514 $this->description = $description;
515
516 return $this;
517 }
518
523 public function withCode(?string $code)
524 {
525 $this->code = $code;
526
527 return $this;
528 }
529
534 public function withCartDiscounts(?CartDiscountReferenceCollection $cartDiscounts)
535 {
536 $this->cartDiscounts = $cartDiscounts;
537
538 return $this;
539 }
540
545 public function withStores(?StoreKeyReferenceCollection $stores)
546 {
547 $this->stores = $stores;
548
549 return $this;
550 }
551
556 public function withCartPredicate(?string $cartPredicate)
557 {
558 $this->cartPredicate = $cartPredicate;
559
560 return $this;
561 }
562
567 public function withIsActive(?bool $isActive)
568 {
569 $this->isActive = $isActive;
570
571 return $this;
572 }
573
578 public function withReferences(?ReferenceCollection $references)
579 {
580 $this->references = $references;
581
582 return $this;
583 }
584
589 public function withMaxApplications(?int $maxApplications)
590 {
591 $this->maxApplications = $maxApplications;
592
593 return $this;
594 }
595
600 public function withMaxApplicationsPerCustomer(?int $maxApplicationsPerCustomer)
601 {
602 $this->maxApplicationsPerCustomer = $maxApplicationsPerCustomer;
603
604 return $this;
605 }
606
611 public function withCustom(?CustomFields $custom)
612 {
613 $this->custom = $custom;
614
615 return $this;
616 }
617
622 public function withGroups(?array $groups)
623 {
624 $this->groups = $groups;
625
626 return $this;
627 }
628
633 public function withValidFrom(?DateTimeImmutable $validFrom)
634 {
635 $this->validFrom = $validFrom;
636
637 return $this;
638 }
639
644 public function withValidUntil(?DateTimeImmutable $validUntil)
645 {
646 $this->validUntil = $validUntil;
647
648 return $this;
649 }
650
655 public function withApplicationVersion(?int $applicationVersion)
656 {
657 $this->applicationVersion = $applicationVersion;
658
659 return $this;
660 }
661
666 public function withLastModifiedByBuilder(?LastModifiedByBuilder $lastModifiedBy)
667 {
668 $this->lastModifiedBy = $lastModifiedBy;
669
670 return $this;
671 }
672
677 public function withCreatedByBuilder(?CreatedByBuilder $createdBy)
678 {
679 $this->createdBy = $createdBy;
680
681 return $this;
682 }
683
689 {
690 $this->name = $name;
691
692 return $this;
693 }
694
699 public function withDescriptionBuilder(?LocalizedStringBuilder $description)
700 {
701 $this->description = $description;
702
703 return $this;
704 }
705
710 public function withCustomBuilder(?CustomFieldsBuilder $custom)
711 {
712 $this->custom = $custom;
713
714 return $this;
715 }
716
717 public function build(): DiscountCode
718 {
719 return new DiscountCodeModel(
720 $this->id,
721 $this->version,
722 $this->createdAt,
723 $this->lastModifiedAt,
724 $this->key,
725 $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy,
726 $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy,
727 $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name,
728 $this->description instanceof LocalizedStringBuilder ? $this->description->build() : $this->description,
729 $this->code,
730 $this->cartDiscounts,
731 $this->stores,
732 $this->cartPredicate,
733 $this->isActive,
734 $this->references,
735 $this->maxApplications,
736 $this->maxApplicationsPerCustomer,
737 $this->custom instanceof CustomFieldsBuilder ? $this->custom->build() : $this->custom,
738 $this->groups,
739 $this->validFrom,
740 $this->validUntil,
741 $this->applicationVersion
742 );
743 }
744
745 public static function of(): DiscountCodeBuilder
746 {
747 return new self();
748 }
749}
withCartDiscounts(?CartDiscountReferenceCollection $cartDiscounts)
withLastModifiedByBuilder(?LastModifiedByBuilder $lastModifiedBy)