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
280 public function getReferences()
281 {
282 return $this->references;
283 }
284
292 public function getValidFrom()
293 {
294 return $this->validFrom;
295 }
296
304 public function getValidUntil()
305 {
306 return $this->validUntil;
307 }
308
313 public function withId(?string $id)
314 {
315 $this->id = $id;
316
317 return $this;
318 }
319
324 public function withVersion(?int $version)
325 {
326 $this->version = $version;
327
328 return $this;
329 }
330
335 public function withCreatedAt(?DateTimeImmutable $createdAt)
336 {
337 $this->createdAt = $createdAt;
338
339 return $this;
340 }
341
346 public function withLastModifiedAt(?DateTimeImmutable $lastModifiedAt)
347 {
348 $this->lastModifiedAt = $lastModifiedAt;
349
350 return $this;
351 }
352
357 public function withLastModifiedBy(?LastModifiedBy $lastModifiedBy)
358 {
359 $this->lastModifiedBy = $lastModifiedBy;
360
361 return $this;
362 }
363
368 public function withCreatedBy(?CreatedBy $createdBy)
369 {
370 $this->createdBy = $createdBy;
371
372 return $this;
373 }
374
379 public function withName(?LocalizedString $name)
380 {
381 $this->name = $name;
382
383 return $this;
384 }
385
390 public function withKey(?string $key)
391 {
392 $this->key = $key;
393
394 return $this;
395 }
396
401 public function withDescription(?LocalizedString $description)
402 {
403 $this->description = $description;
404
405 return $this;
406 }
407
412 public function withValue(?ProductDiscountValue $value)
413 {
414 $this->value = $value;
415
416 return $this;
417 }
418
423 public function withPredicate(?string $predicate)
424 {
425 $this->predicate = $predicate;
426
427 return $this;
428 }
429
434 public function withSortOrder(?string $sortOrder)
435 {
436 $this->sortOrder = $sortOrder;
437
438 return $this;
439 }
440
445 public function withIsActive(?bool $isActive)
446 {
447 $this->isActive = $isActive;
448
449 return $this;
450 }
451
456 public function withReferences(?ReferenceCollection $references)
457 {
458 $this->references = $references;
459
460 return $this;
461 }
462
467 public function withValidFrom(?DateTimeImmutable $validFrom)
468 {
469 $this->validFrom = $validFrom;
470
471 return $this;
472 }
473
478 public function withValidUntil(?DateTimeImmutable $validUntil)
479 {
480 $this->validUntil = $validUntil;
481
482 return $this;
483 }
484
489 public function withLastModifiedByBuilder(?LastModifiedByBuilder $lastModifiedBy)
490 {
491 $this->lastModifiedBy = $lastModifiedBy;
492
493 return $this;
494 }
495
500 public function withCreatedByBuilder(?CreatedByBuilder $createdBy)
501 {
502 $this->createdBy = $createdBy;
503
504 return $this;
505 }
506
512 {
513 $this->name = $name;
514
515 return $this;
516 }
517
522 public function withDescriptionBuilder(?LocalizedStringBuilder $description)
523 {
524 $this->description = $description;
525
526 return $this;
527 }
528
534 {
535 $this->value = $value;
536
537 return $this;
538 }
539
540 public function build(): ProductDiscount
541 {
542 return new ProductDiscountModel(
543 $this->id,
544 $this->version,
545 $this->createdAt,
546 $this->lastModifiedAt,
547 $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy,
548 $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy,
549 $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name,
550 $this->key,
551 $this->description instanceof LocalizedStringBuilder ? $this->description->build() : $this->description,
552 $this->value instanceof ProductDiscountValueBuilder ? $this->value->build() : $this->value,
553 $this->predicate,
554 $this->sortOrder,
555 $this->isActive,
556 $this->references,
557 $this->validFrom,
558 $this->validUntil
559 );
560 }
561
562 public static function of(): ProductDiscountBuilder
563 {
564 return new self();
565 }
566}