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
30use DateTimeImmutable;
31use stdClass;
32
36final class CartDiscountBuilder implements Builder
37{
42 private $id;
43
48 private $version;
49
54 private $createdAt;
55
60 private $lastModifiedAt;
61
66 private $lastModifiedBy;
67
72 private $createdBy;
73
78 private $name;
79
84 private $key;
85
90 private $description;
91
96 private $value;
97
102 private $cartPredicate;
103
108 private $target;
109
114 private $sortOrder;
115
120 private $stores;
121
126 private $isActive;
127
132 private $validFrom;
133
138 private $validUntil;
139
144 private $requiresDiscountCode;
145
150 private $references;
151
156 private $stackingMode;
157
162 private $custom;
163
168 private $discountGroup;
169
176 public function getId()
177 {
178 return $this->id;
179 }
180
187 public function getVersion()
188 {
189 return $this->version;
190 }
191
198 public function getCreatedAt()
199 {
200 return $this->createdAt;
201 }
202
209 public function getLastModifiedAt()
210 {
211 return $this->lastModifiedAt;
212 }
213
220 public function getLastModifiedBy()
221 {
222 return $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy;
223 }
224
231 public function getCreatedBy()
232 {
233 return $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy;
234 }
235
242 public function getName()
243 {
244 return $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name;
245 }
246
253 public function getKey()
254 {
255 return $this->key;
256 }
257
264 public function getDescription()
265 {
266 return $this->description instanceof LocalizedStringBuilder ? $this->description->build() : $this->description;
267 }
268
275 public function getValue()
276 {
277 return $this->value instanceof CartDiscountValueBuilder ? $this->value->build() : $this->value;
278 }
279
286 public function getCartPredicate()
287 {
288 return $this->cartPredicate;
289 }
290
298 public function getTarget()
299 {
300 return $this->target instanceof CartDiscountTargetBuilder ? $this->target->build() : $this->target;
301 }
302
311 public function getSortOrder()
312 {
313 return $this->sortOrder;
314 }
315
325 public function getStores()
326 {
327 return $this->stores;
328 }
329
336 public function getIsActive()
337 {
338 return $this->isActive;
339 }
340
347 public function getValidFrom()
348 {
349 return $this->validFrom;
350 }
351
358 public function getValidUntil()
359 {
360 return $this->validUntil;
361 }
362
369 public function getRequiresDiscountCode()
370 {
371 return $this->requiresDiscountCode;
372 }
373
381 public function getReferences()
382 {
383 return $this->references;
384 }
385
392 public function getStackingMode()
393 {
394 return $this->stackingMode;
395 }
396
403 public function getCustom()
404 {
405 return $this->custom instanceof CustomFieldsBuilder ? $this->custom->build() : $this->custom;
406 }
407
414 public function getDiscountGroup()
415 {
416 return $this->discountGroup instanceof DiscountGroupReferenceBuilder ? $this->discountGroup->build() : $this->discountGroup;
417 }
418
423 public function withId(?string $id)
424 {
425 $this->id = $id;
426
427 return $this;
428 }
429
434 public function withVersion(?int $version)
435 {
436 $this->version = $version;
437
438 return $this;
439 }
440
445 public function withCreatedAt(?DateTimeImmutable $createdAt)
446 {
447 $this->createdAt = $createdAt;
448
449 return $this;
450 }
451
456 public function withLastModifiedAt(?DateTimeImmutable $lastModifiedAt)
457 {
458 $this->lastModifiedAt = $lastModifiedAt;
459
460 return $this;
461 }
462
467 public function withLastModifiedBy(?LastModifiedBy $lastModifiedBy)
468 {
469 $this->lastModifiedBy = $lastModifiedBy;
470
471 return $this;
472 }
473
478 public function withCreatedBy(?CreatedBy $createdBy)
479 {
480 $this->createdBy = $createdBy;
481
482 return $this;
483 }
484
489 public function withName(?LocalizedString $name)
490 {
491 $this->name = $name;
492
493 return $this;
494 }
495
500 public function withKey(?string $key)
501 {
502 $this->key = $key;
503
504 return $this;
505 }
506
511 public function withDescription(?LocalizedString $description)
512 {
513 $this->description = $description;
514
515 return $this;
516 }
517
522 public function withValue(?CartDiscountValue $value)
523 {
524 $this->value = $value;
525
526 return $this;
527 }
528
533 public function withCartPredicate(?string $cartPredicate)
534 {
535 $this->cartPredicate = $cartPredicate;
536
537 return $this;
538 }
539
544 public function withTarget(?CartDiscountTarget $target)
545 {
546 $this->target = $target;
547
548 return $this;
549 }
550
555 public function withSortOrder(?string $sortOrder)
556 {
557 $this->sortOrder = $sortOrder;
558
559 return $this;
560 }
561
566 public function withStores(?StoreKeyReferenceCollection $stores)
567 {
568 $this->stores = $stores;
569
570 return $this;
571 }
572
577 public function withIsActive(?bool $isActive)
578 {
579 $this->isActive = $isActive;
580
581 return $this;
582 }
583
588 public function withValidFrom(?DateTimeImmutable $validFrom)
589 {
590 $this->validFrom = $validFrom;
591
592 return $this;
593 }
594
599 public function withValidUntil(?DateTimeImmutable $validUntil)
600 {
601 $this->validUntil = $validUntil;
602
603 return $this;
604 }
605
610 public function withRequiresDiscountCode(?bool $requiresDiscountCode)
611 {
612 $this->requiresDiscountCode = $requiresDiscountCode;
613
614 return $this;
615 }
616
621 public function withReferences(?ReferenceCollection $references)
622 {
623 $this->references = $references;
624
625 return $this;
626 }
627
632 public function withStackingMode(?string $stackingMode)
633 {
634 $this->stackingMode = $stackingMode;
635
636 return $this;
637 }
638
643 public function withCustom(?CustomFields $custom)
644 {
645 $this->custom = $custom;
646
647 return $this;
648 }
649
654 public function withDiscountGroup(?DiscountGroupReference $discountGroup)
655 {
656 $this->discountGroup = $discountGroup;
657
658 return $this;
659 }
660
665 public function withLastModifiedByBuilder(?LastModifiedByBuilder $lastModifiedBy)
666 {
667 $this->lastModifiedBy = $lastModifiedBy;
668
669 return $this;
670 }
671
676 public function withCreatedByBuilder(?CreatedByBuilder $createdBy)
677 {
678 $this->createdBy = $createdBy;
679
680 return $this;
681 }
682
688 {
689 $this->name = $name;
690
691 return $this;
692 }
693
698 public function withDescriptionBuilder(?LocalizedStringBuilder $description)
699 {
700 $this->description = $description;
701
702 return $this;
703 }
704
710 {
711 $this->value = $value;
712
713 return $this;
714 }
715
721 {
722 $this->target = $target;
723
724 return $this;
725 }
726
731 public function withCustomBuilder(?CustomFieldsBuilder $custom)
732 {
733 $this->custom = $custom;
734
735 return $this;
736 }
737
743 {
744 $this->discountGroup = $discountGroup;
745
746 return $this;
747 }
748
749 public function build(): CartDiscount
750 {
751 return new CartDiscountModel(
752 $this->id,
753 $this->version,
754 $this->createdAt,
755 $this->lastModifiedAt,
756 $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy,
757 $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy,
758 $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name,
759 $this->key,
760 $this->description instanceof LocalizedStringBuilder ? $this->description->build() : $this->description,
761 $this->value instanceof CartDiscountValueBuilder ? $this->value->build() : $this->value,
762 $this->cartPredicate,
763 $this->target instanceof CartDiscountTargetBuilder ? $this->target->build() : $this->target,
764 $this->sortOrder,
765 $this->stores,
766 $this->isActive,
767 $this->validFrom,
768 $this->validUntil,
769 $this->requiresDiscountCode,
770 $this->references,
771 $this->stackingMode,
772 $this->custom instanceof CustomFieldsBuilder ? $this->custom->build() : $this->custom,
773 $this->discountGroup instanceof DiscountGroupReferenceBuilder ? $this->discountGroup->build() : $this->discountGroup
774 );
775 }
776
777 public static function of(): CartDiscountBuilder
778 {
779 return new self();
780 }
781}
withDiscountGroup(?DiscountGroupReference $discountGroup)
withLastModifiedByBuilder(?LastModifiedByBuilder $lastModifiedBy)
withDiscountGroupBuilder(?DiscountGroupReferenceBuilder $discountGroup)