commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
DirectDiscountDraftBuilder.php
1<?php
2
3declare(strict_types=1);
10
20use stdClass;
21
25final class DirectDiscountDraftBuilder implements Builder
26{
31 private $value;
32
37 private $target;
38
43 private $participateInBestDealSelection;
44
51 public function getValue()
52 {
53 return $this->value instanceof CartDiscountValueDraftBuilder ? $this->value->build() : $this->value;
54 }
55
63 public function getTarget()
64 {
65 return $this->target instanceof CartDiscountTargetBuilder ? $this->target->build() : $this->target;
66 }
67
79 {
80 return $this->participateInBestDealSelection;
81 }
82
87 public function withValue(?CartDiscountValueDraft $value)
88 {
89 $this->value = $value;
90
91 return $this;
92 }
93
98 public function withTarget(?CartDiscountTarget $target)
99 {
100 $this->target = $target;
101
102 return $this;
103 }
104
109 public function withParticipateInBestDealSelection(?bool $participateInBestDealSelection)
110 {
111 $this->participateInBestDealSelection = $participateInBestDealSelection;
112
113 return $this;
114 }
115
121 {
122 $this->value = $value;
123
124 return $this;
125 }
126
132 {
133 $this->target = $target;
134
135 return $this;
136 }
137
138 public function build(): DirectDiscountDraft
139 {
140 return new DirectDiscountDraftModel(
141 $this->value instanceof CartDiscountValueDraftBuilder ? $this->value->build() : $this->value,
142 $this->target instanceof CartDiscountTargetBuilder ? $this->target->build() : $this->target,
143 $this->participateInBestDealSelection
144 );
145 }
146
147 public static function of(): DirectDiscountDraftBuilder
148 {
149 return new self();
150 }
151}
withParticipateInBestDealSelection(?bool $participateInBestDealSelection)