commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
ProductDiscountBuilder.php
1<?php
2
3declare(strict_types=1);
10
25use DateTimeImmutable;
26use stdClass;
27
31final class ProductDiscountBuilder implements Builder
32{
37 private $id;
38
43 private $version;
44
49 private $createdAt;
50
55 private $lastModifiedAt;
56
61 private $lastModifiedBy;
62
67 private $createdBy;
68
73 private $name;
74
79 private $key;
80
85 private $description;
86
91 private $value;
92
97 private $predicate;
98
103 private $sortOrder;
104
109 private $isActive;
110
115 private $references;
116
121 private $validFrom;
122
127 private $validUntil;
128
135 public function getId()
136 {
137 return $this->id;
138 }
139
146 public function getVersion()
147 {
148 return $this->version;
149 }
150
157 public function getCreatedAt()
158 {
159 return $this->createdAt;
160 }
161
168 public function getLastModifiedAt()
169 {
170 return $this->lastModifiedAt;
171 }
172
179 public function getLastModifiedBy()
180 {
181 return $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy;
182 }
183
190 public function getCreatedBy()
191 {
192 return $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy;
193 }
194
201 public function getName()
202 {
203 return $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name;
204 }
205
212 public function getKey()
213 {
214 return $this->key;
215 }
216
223 public function getDescription()
224 {
225 return $this->description instanceof LocalizedStringBuilder ? $this->description->build() : $this->description;
226 }
227
234 public function getValue()
235 {
236 return $this->value instanceof ProductDiscountValueBuilder ? $this->value->build() : $this->value;
237 }
238
245 public function getPredicate()
246 {
247 return $this->predicate;
248 }
249
257 public function getSortOrder()
258 {
259 return $this->sortOrder;
260 }
261
268 public function getIsActive()
269 {
270 return $this->isActive;
271 }
272
279 public function getReferences()
280 {
281 return $this->references;
282 }
283
291 public function getValidFrom()
292 {
293 return $this->validFrom;
294 }
295
303 public function getValidUntil()
304 {
305 return $this->validUntil;
306 }
307
312 public function withId(?string $id)
313 {
314 $this->id = $id;
315
316 return $this;
317 }
318
323 public function withVersion(?int $version)
324 {
325 $this->version = $version;
326
327 return $this;
328 }
329
334 public function withCreatedAt(?DateTimeImmutable $createdAt)
335 {
336 $this->createdAt = $createdAt;
337
338 return $this;
339 }
340
345 public function withLastModifiedAt(?DateTimeImmutable $lastModifiedAt)
346 {
347 $this->lastModifiedAt = $lastModifiedAt;
348
349 return $this;
350 }
351
356 public function withLastModifiedBy(?LastModifiedBy $lastModifiedBy)
357 {
358 $this->lastModifiedBy = $lastModifiedBy;
359
360 return $this;
361 }
362
367 public function withCreatedBy(?CreatedBy $createdBy)
368 {
369 $this->createdBy = $createdBy;
370
371 return $this;
372 }
373
378 public function withName(?LocalizedString $name)
379 {
380 $this->name = $name;
381
382 return $this;
383 }
384
389 public function withKey(?string $key)
390 {
391 $this->key = $key;
392
393 return $this;
394 }
395
400 public function withDescription(?LocalizedString $description)
401 {
402 $this->description = $description;
403
404 return $this;
405 }
406
411 public function withValue(?ProductDiscountValue $value)
412 {
413 $this->value = $value;
414
415 return $this;
416 }
417
422 public function withPredicate(?string $predicate)
423 {
424 $this->predicate = $predicate;
425
426 return $this;
427 }
428
433 public function withSortOrder(?string $sortOrder)
434 {
435 $this->sortOrder = $sortOrder;
436
437 return $this;
438 }
439
444 public function withIsActive(?bool $isActive)
445 {
446 $this->isActive = $isActive;
447
448 return $this;
449 }
450
455 public function withReferences(?ReferenceCollection $references)
456 {
457 $this->references = $references;
458
459 return $this;
460 }
461
466 public function withValidFrom(?DateTimeImmutable $validFrom)
467 {
468 $this->validFrom = $validFrom;
469
470 return $this;
471 }
472
477 public function withValidUntil(?DateTimeImmutable $validUntil)
478 {
479 $this->validUntil = $validUntil;
480
481 return $this;
482 }
483
488 public function withLastModifiedByBuilder(?LastModifiedByBuilder $lastModifiedBy)
489 {
490 $this->lastModifiedBy = $lastModifiedBy;
491
492 return $this;
493 }
494
499 public function withCreatedByBuilder(?CreatedByBuilder $createdBy)
500 {
501 $this->createdBy = $createdBy;
502
503 return $this;
504 }
505
511 {
512 $this->name = $name;
513
514 return $this;
515 }
516
521 public function withDescriptionBuilder(?LocalizedStringBuilder $description)
522 {
523 $this->description = $description;
524
525 return $this;
526 }
527
533 {
534 $this->value = $value;
535
536 return $this;
537 }
538
539 public function build(): ProductDiscount
540 {
541 return new ProductDiscountModel(
542 $this->id,
543 $this->version,
544 $this->createdAt,
545 $this->lastModifiedAt,
546 $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy,
547 $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy,
548 $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name,
549 $this->key,
550 $this->description instanceof LocalizedStringBuilder ? $this->description->build() : $this->description,
551 $this->value instanceof ProductDiscountValueBuilder ? $this->value->build() : $this->value,
552 $this->predicate,
553 $this->sortOrder,
554 $this->isActive,
555 $this->references,
556 $this->validFrom,
557 $this->validUntil
558 );
559 }
560
561 public static function of(): ProductDiscountBuilder
562 {
563 return new self();
564 }
565}