commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
ProductDiscountDraftBuilder.php
1<?php
2
3declare(strict_types=1);
10
18use DateTimeImmutable;
19use stdClass;
20
25{
30 private $name;
31
36 private $key;
37
42 private $description;
43
48 private $value;
49
54 private $predicate;
55
60 private $sortOrder;
61
66 private $isActive;
67
72 private $validFrom;
73
78 private $validUntil;
79
86 public function getName()
87 {
88 return $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name;
89 }
90
97 public function getKey()
98 {
99 return $this->key;
100 }
101
108 public function getDescription()
109 {
110 return $this->description instanceof LocalizedStringBuilder ? $this->description->build() : $this->description;
111 }
112
119 public function getValue()
120 {
121 return $this->value instanceof ProductDiscountValueDraftBuilder ? $this->value->build() : $this->value;
122 }
123
130 public function getPredicate()
131 {
132 return $this->predicate;
133 }
134
142 public function getSortOrder()
143 {
144 return $this->sortOrder;
145 }
146
153 public function getIsActive()
154 {
155 return $this->isActive;
156 }
157
165 public function getValidFrom()
166 {
167 return $this->validFrom;
168 }
169
177 public function getValidUntil()
178 {
179 return $this->validUntil;
180 }
181
186 public function withName(?LocalizedString $name)
187 {
188 $this->name = $name;
189
190 return $this;
191 }
192
197 public function withKey(?string $key)
198 {
199 $this->key = $key;
200
201 return $this;
202 }
203
208 public function withDescription(?LocalizedString $description)
209 {
210 $this->description = $description;
211
212 return $this;
213 }
214
219 public function withValue(?ProductDiscountValueDraft $value)
220 {
221 $this->value = $value;
222
223 return $this;
224 }
225
230 public function withPredicate(?string $predicate)
231 {
232 $this->predicate = $predicate;
233
234 return $this;
235 }
236
241 public function withSortOrder(?string $sortOrder)
242 {
243 $this->sortOrder = $sortOrder;
244
245 return $this;
246 }
247
252 public function withIsActive(?bool $isActive)
253 {
254 $this->isActive = $isActive;
255
256 return $this;
257 }
258
263 public function withValidFrom(?DateTimeImmutable $validFrom)
264 {
265 $this->validFrom = $validFrom;
266
267 return $this;
268 }
269
274 public function withValidUntil(?DateTimeImmutable $validUntil)
275 {
276 $this->validUntil = $validUntil;
277
278 return $this;
279 }
280
286 {
287 $this->name = $name;
288
289 return $this;
290 }
291
296 public function withDescriptionBuilder(?LocalizedStringBuilder $description)
297 {
298 $this->description = $description;
299
300 return $this;
301 }
302
308 {
309 $this->value = $value;
310
311 return $this;
312 }
313
314 public function build(): ProductDiscountDraft
315 {
316 return new ProductDiscountDraftModel(
317 $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name,
318 $this->key,
319 $this->description instanceof LocalizedStringBuilder ? $this->description->build() : $this->description,
320 $this->value instanceof ProductDiscountValueDraftBuilder ? $this->value->build() : $this->value,
321 $this->predicate,
322 $this->sortOrder,
323 $this->isActive,
324 $this->validFrom,
325 $this->validUntil
326 );
327 }
328
329 public static function of(): ProductDiscountDraftBuilder
330 {
331 return new self();
332 }
333}