commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
CategoryBuilder.php
1<?php
2
3declare(strict_types=1);
10
28use DateTimeImmutable;
29use stdClass;
30
34final class CategoryBuilder implements Builder
35{
40 private $id;
41
46 private $version;
47
52 private $createdAt;
53
58 private $lastModifiedAt;
59
64 private $lastModifiedBy;
65
70 private $createdBy;
71
76 private $name;
77
82 private $slug;
83
88 private $description;
89
94 private $ancestors;
95
100 private $parent;
101
106 private $orderHint;
107
112 private $externalId;
113
118 private $metaTitle;
119
124 private $metaDescription;
125
130 private $metaKeywords;
131
136 private $custom;
137
142 private $assets;
143
148 private $key;
149
154 private $stores;
155
162 public function getId()
163 {
164 return $this->id;
165 }
166
173 public function getVersion()
174 {
175 return $this->version;
176 }
177
184 public function getCreatedAt()
185 {
186 return $this->createdAt;
187 }
188
195 public function getLastModifiedAt()
196 {
197 return $this->lastModifiedAt;
198 }
199
206 public function getLastModifiedBy()
207 {
208 return $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy;
209 }
210
217 public function getCreatedBy()
218 {
219 return $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy;
220 }
221
228 public function getName()
229 {
230 return $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name;
231 }
232
242 public function getSlug()
243 {
244 return $this->slug instanceof LocalizedStringBuilder ? $this->slug->build() : $this->slug;
245 }
246
253 public function getDescription()
254 {
255 return $this->description instanceof LocalizedStringBuilder ? $this->description->build() : $this->description;
256 }
257
264 public function getAncestors()
265 {
266 return $this->ancestors;
267 }
268
275 public function getParent()
276 {
277 return $this->parent instanceof CategoryReferenceBuilder ? $this->parent->build() : $this->parent;
278 }
279
286 public function getOrderHint()
287 {
288 return $this->orderHint;
289 }
290
297 public function getExternalId()
298 {
299 return $this->externalId;
300 }
301
308 public function getMetaTitle()
309 {
310 return $this->metaTitle instanceof LocalizedStringBuilder ? $this->metaTitle->build() : $this->metaTitle;
311 }
312
319 public function getMetaDescription()
320 {
321 return $this->metaDescription instanceof LocalizedStringBuilder ? $this->metaDescription->build() : $this->metaDescription;
322 }
323
330 public function getMetaKeywords()
331 {
332 return $this->metaKeywords instanceof LocalizedStringBuilder ? $this->metaKeywords->build() : $this->metaKeywords;
333 }
334
341 public function getCustom()
342 {
343 return $this->custom instanceof CustomFieldsBuilder ? $this->custom->build() : $this->custom;
344 }
345
352 public function getAssets()
353 {
354 return $this->assets;
355 }
356
363 public function getKey()
364 {
365 return $this->key;
366 }
367
376 public function getStores()
377 {
378 return $this->stores;
379 }
380
385 public function withId(?string $id)
386 {
387 $this->id = $id;
388
389 return $this;
390 }
391
396 public function withVersion(?int $version)
397 {
398 $this->version = $version;
399
400 return $this;
401 }
402
407 public function withCreatedAt(?DateTimeImmutable $createdAt)
408 {
409 $this->createdAt = $createdAt;
410
411 return $this;
412 }
413
418 public function withLastModifiedAt(?DateTimeImmutable $lastModifiedAt)
419 {
420 $this->lastModifiedAt = $lastModifiedAt;
421
422 return $this;
423 }
424
429 public function withLastModifiedBy(?LastModifiedBy $lastModifiedBy)
430 {
431 $this->lastModifiedBy = $lastModifiedBy;
432
433 return $this;
434 }
435
440 public function withCreatedBy(?CreatedBy $createdBy)
441 {
442 $this->createdBy = $createdBy;
443
444 return $this;
445 }
446
451 public function withName(?LocalizedString $name)
452 {
453 $this->name = $name;
454
455 return $this;
456 }
457
462 public function withSlug(?LocalizedString $slug)
463 {
464 $this->slug = $slug;
465
466 return $this;
467 }
468
473 public function withDescription(?LocalizedString $description)
474 {
475 $this->description = $description;
476
477 return $this;
478 }
479
484 public function withAncestors(?CategoryReferenceCollection $ancestors)
485 {
486 $this->ancestors = $ancestors;
487
488 return $this;
489 }
490
495 public function withParent(?CategoryReference $parent)
496 {
497 $this->parent = $parent;
498
499 return $this;
500 }
501
506 public function withOrderHint(?string $orderHint)
507 {
508 $this->orderHint = $orderHint;
509
510 return $this;
511 }
512
517 public function withExternalId(?string $externalId)
518 {
519 $this->externalId = $externalId;
520
521 return $this;
522 }
523
528 public function withMetaTitle(?LocalizedString $metaTitle)
529 {
530 $this->metaTitle = $metaTitle;
531
532 return $this;
533 }
534
539 public function withMetaDescription(?LocalizedString $metaDescription)
540 {
541 $this->metaDescription = $metaDescription;
542
543 return $this;
544 }
545
550 public function withMetaKeywords(?LocalizedString $metaKeywords)
551 {
552 $this->metaKeywords = $metaKeywords;
553
554 return $this;
555 }
556
561 public function withCustom(?CustomFields $custom)
562 {
563 $this->custom = $custom;
564
565 return $this;
566 }
567
572 public function withAssets(?AssetCollection $assets)
573 {
574 $this->assets = $assets;
575
576 return $this;
577 }
578
583 public function withKey(?string $key)
584 {
585 $this->key = $key;
586
587 return $this;
588 }
589
594 public function withStores(?StoreKeyReferenceCollection $stores)
595 {
596 $this->stores = $stores;
597
598 return $this;
599 }
600
605 public function withLastModifiedByBuilder(?LastModifiedByBuilder $lastModifiedBy)
606 {
607 $this->lastModifiedBy = $lastModifiedBy;
608
609 return $this;
610 }
611
616 public function withCreatedByBuilder(?CreatedByBuilder $createdBy)
617 {
618 $this->createdBy = $createdBy;
619
620 return $this;
621 }
622
628 {
629 $this->name = $name;
630
631 return $this;
632 }
633
639 {
640 $this->slug = $slug;
641
642 return $this;
643 }
644
649 public function withDescriptionBuilder(?LocalizedStringBuilder $description)
650 {
651 $this->description = $description;
652
653 return $this;
654 }
655
661 {
662 $this->parent = $parent;
663
664 return $this;
665 }
666
671 public function withMetaTitleBuilder(?LocalizedStringBuilder $metaTitle)
672 {
673 $this->metaTitle = $metaTitle;
674
675 return $this;
676 }
677
682 public function withMetaDescriptionBuilder(?LocalizedStringBuilder $metaDescription)
683 {
684 $this->metaDescription = $metaDescription;
685
686 return $this;
687 }
688
693 public function withMetaKeywordsBuilder(?LocalizedStringBuilder $metaKeywords)
694 {
695 $this->metaKeywords = $metaKeywords;
696
697 return $this;
698 }
699
704 public function withCustomBuilder(?CustomFieldsBuilder $custom)
705 {
706 $this->custom = $custom;
707
708 return $this;
709 }
710
711 public function build(): Category
712 {
713 return new CategoryModel(
714 $this->id,
715 $this->version,
716 $this->createdAt,
717 $this->lastModifiedAt,
718 $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy,
719 $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy,
720 $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name,
721 $this->slug instanceof LocalizedStringBuilder ? $this->slug->build() : $this->slug,
722 $this->description instanceof LocalizedStringBuilder ? $this->description->build() : $this->description,
723 $this->ancestors,
724 $this->parent instanceof CategoryReferenceBuilder ? $this->parent->build() : $this->parent,
725 $this->orderHint,
726 $this->externalId,
727 $this->metaTitle instanceof LocalizedStringBuilder ? $this->metaTitle->build() : $this->metaTitle,
728 $this->metaDescription instanceof LocalizedStringBuilder ? $this->metaDescription->build() : $this->metaDescription,
729 $this->metaKeywords instanceof LocalizedStringBuilder ? $this->metaKeywords->build() : $this->metaKeywords,
730 $this->custom instanceof CustomFieldsBuilder ? $this->custom->build() : $this->custom,
731 $this->assets,
732 $this->key,
733 $this->stores
734 );
735 }
736
737 public static function of(): CategoryBuilder
738 {
739 return new self();
740 }
741}
withMetaDescription(?LocalizedString $metaDescription)
withMetaTitleBuilder(?LocalizedStringBuilder $metaTitle)
withParentBuilder(?CategoryReferenceBuilder $parent)
withAncestors(?CategoryReferenceCollection $ancestors)
withDescriptionBuilder(?LocalizedStringBuilder $description)
withLastModifiedAt(?DateTimeImmutable $lastModifiedAt)
withMetaDescriptionBuilder(?LocalizedStringBuilder $metaDescription)
withStores(?StoreKeyReferenceCollection $stores)
withLastModifiedBy(?LastModifiedBy $lastModifiedBy)
withMetaKeywordsBuilder(?LocalizedStringBuilder $metaKeywords)
withLastModifiedByBuilder(?LastModifiedByBuilder $lastModifiedBy)