commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
CartDiscountBuilder.php
1<?php
2
3declare(strict_types=1);
10
32use DateTimeImmutable;
33use stdClass;
34
38final class CartDiscountBuilder implements Builder
39{
44 private $id;
45
50 private $version;
51
56 private $createdAt;
57
62 private $lastModifiedAt;
63
68 private $lastModifiedBy;
69
74 private $createdBy;
75
80 private $name;
81
86 private $key;
87
92 private $description;
93
98 private $value;
99
104 private $cartPredicate;
105
110 private $target;
111
116 private $sortOrder;
117
122 private $stores;
123
128 private $isActive;
129
134 private $validFrom;
135
140 private $validUntil;
141
146 private $requiresDiscountCode;
147
152 private $references;
153
158 private $stackingMode;
159
164 private $custom;
165
170 private $discountGroup;
171
176 private $recurringOrderScope;
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 getName()
251 {
252 return $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name;
253 }
254
261 public function getKey()
262 {
263 return $this->key;
264 }
265
272 public function getDescription()
273 {
274 return $this->description instanceof LocalizedStringBuilder ? $this->description->build() : $this->description;
275 }
276
283 public function getValue()
284 {
285 return $this->value instanceof CartDiscountValueBuilder ? $this->value->build() : $this->value;
286 }
287
294 public function getCartPredicate()
295 {
296 return $this->cartPredicate;
297 }
298
306 public function getTarget()
307 {
308 return $this->target instanceof CartDiscountTargetBuilder ? $this->target->build() : $this->target;
309 }
310
319 public function getSortOrder()
320 {
321 return $this->sortOrder;
322 }
323
333 public function getStores()
334 {
335 return $this->stores;
336 }
337
344 public function getIsActive()
345 {
346 return $this->isActive;
347 }
348
355 public function getValidFrom()
356 {
357 return $this->validFrom;
358 }
359
366 public function getValidUntil()
367 {
368 return $this->validUntil;
369 }
370
377 public function getRequiresDiscountCode()
378 {
379 return $this->requiresDiscountCode;
380 }
381
389 public function getReferences()
390 {
391 return $this->references;
392 }
393
400 public function getStackingMode()
401 {
402 return $this->stackingMode;
403 }
404
411 public function getCustom()
412 {
413 return $this->custom instanceof CustomFieldsBuilder ? $this->custom->build() : $this->custom;
414 }
415
422 public function getDiscountGroup()
423 {
424 return $this->discountGroup instanceof DiscountGroupReferenceBuilder ? $this->discountGroup->build() : $this->discountGroup;
425 }
426
434 public function getRecurringOrderScope()
435 {
436 return $this->recurringOrderScope instanceof RecurringOrderScopeBuilder ? $this->recurringOrderScope->build() : $this->recurringOrderScope;
437 }
438
443 public function withId(?string $id)
444 {
445 $this->id = $id;
446
447 return $this;
448 }
449
454 public function withVersion(?int $version)
455 {
456 $this->version = $version;
457
458 return $this;
459 }
460
465 public function withCreatedAt(?DateTimeImmutable $createdAt)
466 {
467 $this->createdAt = $createdAt;
468
469 return $this;
470 }
471
476 public function withLastModifiedAt(?DateTimeImmutable $lastModifiedAt)
477 {
478 $this->lastModifiedAt = $lastModifiedAt;
479
480 return $this;
481 }
482
487 public function withLastModifiedBy(?LastModifiedBy $lastModifiedBy)
488 {
489 $this->lastModifiedBy = $lastModifiedBy;
490
491 return $this;
492 }
493
498 public function withCreatedBy(?CreatedBy $createdBy)
499 {
500 $this->createdBy = $createdBy;
501
502 return $this;
503 }
504
509 public function withName(?LocalizedString $name)
510 {
511 $this->name = $name;
512
513 return $this;
514 }
515
520 public function withKey(?string $key)
521 {
522 $this->key = $key;
523
524 return $this;
525 }
526
531 public function withDescription(?LocalizedString $description)
532 {
533 $this->description = $description;
534
535 return $this;
536 }
537
542 public function withValue(?CartDiscountValue $value)
543 {
544 $this->value = $value;
545
546 return $this;
547 }
548
553 public function withCartPredicate(?string $cartPredicate)
554 {
555 $this->cartPredicate = $cartPredicate;
556
557 return $this;
558 }
559
564 public function withTarget(?CartDiscountTarget $target)
565 {
566 $this->target = $target;
567
568 return $this;
569 }
570
575 public function withSortOrder(?string $sortOrder)
576 {
577 $this->sortOrder = $sortOrder;
578
579 return $this;
580 }
581
586 public function withStores(?StoreKeyReferenceCollection $stores)
587 {
588 $this->stores = $stores;
589
590 return $this;
591 }
592
597 public function withIsActive(?bool $isActive)
598 {
599 $this->isActive = $isActive;
600
601 return $this;
602 }
603
608 public function withValidFrom(?DateTimeImmutable $validFrom)
609 {
610 $this->validFrom = $validFrom;
611
612 return $this;
613 }
614
619 public function withValidUntil(?DateTimeImmutable $validUntil)
620 {
621 $this->validUntil = $validUntil;
622
623 return $this;
624 }
625
630 public function withRequiresDiscountCode(?bool $requiresDiscountCode)
631 {
632 $this->requiresDiscountCode = $requiresDiscountCode;
633
634 return $this;
635 }
636
641 public function withReferences(?ReferenceCollection $references)
642 {
643 $this->references = $references;
644
645 return $this;
646 }
647
652 public function withStackingMode(?string $stackingMode)
653 {
654 $this->stackingMode = $stackingMode;
655
656 return $this;
657 }
658
663 public function withCustom(?CustomFields $custom)
664 {
665 $this->custom = $custom;
666
667 return $this;
668 }
669
674 public function withDiscountGroup(?DiscountGroupReference $discountGroup)
675 {
676 $this->discountGroup = $discountGroup;
677
678 return $this;
679 }
680
685 public function withRecurringOrderScope(?RecurringOrderScope $recurringOrderScope)
686 {
687 $this->recurringOrderScope = $recurringOrderScope;
688
689 return $this;
690 }
691
696 public function withLastModifiedByBuilder(?LastModifiedByBuilder $lastModifiedBy)
697 {
698 $this->lastModifiedBy = $lastModifiedBy;
699
700 return $this;
701 }
702
707 public function withCreatedByBuilder(?CreatedByBuilder $createdBy)
708 {
709 $this->createdBy = $createdBy;
710
711 return $this;
712 }
713
719 {
720 $this->name = $name;
721
722 return $this;
723 }
724
729 public function withDescriptionBuilder(?LocalizedStringBuilder $description)
730 {
731 $this->description = $description;
732
733 return $this;
734 }
735
741 {
742 $this->value = $value;
743
744 return $this;
745 }
746
752 {
753 $this->target = $target;
754
755 return $this;
756 }
757
762 public function withCustomBuilder(?CustomFieldsBuilder $custom)
763 {
764 $this->custom = $custom;
765
766 return $this;
767 }
768
774 {
775 $this->discountGroup = $discountGroup;
776
777 return $this;
778 }
779
784 public function withRecurringOrderScopeBuilder(?RecurringOrderScopeBuilder $recurringOrderScope)
785 {
786 $this->recurringOrderScope = $recurringOrderScope;
787
788 return $this;
789 }
790
791 public function build(): CartDiscount
792 {
793 return new CartDiscountModel(
794 $this->id,
795 $this->version,
796 $this->createdAt,
797 $this->lastModifiedAt,
798 $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy,
799 $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy,
800 $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name,
801 $this->key,
802 $this->description instanceof LocalizedStringBuilder ? $this->description->build() : $this->description,
803 $this->value instanceof CartDiscountValueBuilder ? $this->value->build() : $this->value,
804 $this->cartPredicate,
805 $this->target instanceof CartDiscountTargetBuilder ? $this->target->build() : $this->target,
806 $this->sortOrder,
807 $this->stores,
808 $this->isActive,
809 $this->validFrom,
810 $this->validUntil,
811 $this->requiresDiscountCode,
812 $this->references,
813 $this->stackingMode,
814 $this->custom instanceof CustomFieldsBuilder ? $this->custom->build() : $this->custom,
815 $this->discountGroup instanceof DiscountGroupReferenceBuilder ? $this->discountGroup->build() : $this->discountGroup,
816 $this->recurringOrderScope instanceof RecurringOrderScopeBuilder ? $this->recurringOrderScope->build() : $this->recurringOrderScope
817 );
818 }
819
820 public static function of(): CartDiscountBuilder
821 {
822 return new self();
823 }
824}
withDiscountGroup(?DiscountGroupReference $discountGroup)
withLastModifiedByBuilder(?LastModifiedByBuilder $lastModifiedBy)
withRecurringOrderScopeBuilder(?RecurringOrderScopeBuilder $recurringOrderScope)
withDiscountGroupBuilder(?DiscountGroupReferenceBuilder $discountGroup)
withRecurringOrderScope(?RecurringOrderScope $recurringOrderScope)