commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
CategoryBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
27 use DateTimeImmutable;
28 use stdClass;
29 
33 final class CategoryBuilder implements Builder
34 {
39  private $id;
40 
45  private $version;
46 
51  private $createdAt;
52 
57  private $lastModifiedAt;
58 
63  private $lastModifiedBy;
64 
69  private $createdBy;
70 
75  private $name;
76 
81  private $slug;
82 
87  private $description;
88 
93  private $ancestors;
94 
99  private $parent;
100 
105  private $orderHint;
106 
111  private $externalId;
112 
117  private $metaTitle;
118 
123  private $metaDescription;
124 
129  private $metaKeywords;
130 
135  private $custom;
136 
141  private $assets;
142 
147  private $key;
148 
155  public function getId()
156  {
157  return $this->id;
158  }
159 
166  public function getVersion()
167  {
168  return $this->version;
169  }
170 
177  public function getCreatedAt()
178  {
179  return $this->createdAt;
180  }
181 
188  public function getLastModifiedAt()
189  {
190  return $this->lastModifiedAt;
191  }
192 
199  public function getLastModifiedBy()
200  {
201  return $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy;
202  }
203 
210  public function getCreatedBy()
211  {
212  return $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy;
213  }
214 
221  public function getName()
222  {
223  return $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name;
224  }
225 
235  public function getSlug()
236  {
237  return $this->slug instanceof LocalizedStringBuilder ? $this->slug->build() : $this->slug;
238  }
239 
246  public function getDescription()
247  {
248  return $this->description instanceof LocalizedStringBuilder ? $this->description->build() : $this->description;
249  }
250 
257  public function getAncestors()
258  {
259  return $this->ancestors;
260  }
261 
268  public function getParent()
269  {
270  return $this->parent instanceof CategoryReferenceBuilder ? $this->parent->build() : $this->parent;
271  }
272 
279  public function getOrderHint()
280  {
281  return $this->orderHint;
282  }
283 
290  public function getExternalId()
291  {
292  return $this->externalId;
293  }
294 
301  public function getMetaTitle()
302  {
303  return $this->metaTitle instanceof LocalizedStringBuilder ? $this->metaTitle->build() : $this->metaTitle;
304  }
305 
312  public function getMetaDescription()
313  {
314  return $this->metaDescription instanceof LocalizedStringBuilder ? $this->metaDescription->build() : $this->metaDescription;
315  }
316 
323  public function getMetaKeywords()
324  {
325  return $this->metaKeywords instanceof LocalizedStringBuilder ? $this->metaKeywords->build() : $this->metaKeywords;
326  }
327 
334  public function getCustom()
335  {
336  return $this->custom instanceof CustomFieldsBuilder ? $this->custom->build() : $this->custom;
337  }
338 
345  public function getAssets()
346  {
347  return $this->assets;
348  }
349 
356  public function getKey()
357  {
358  return $this->key;
359  }
360 
365  public function withId(?string $id)
366  {
367  $this->id = $id;
368 
369  return $this;
370  }
371 
376  public function withVersion(?int $version)
377  {
378  $this->version = $version;
379 
380  return $this;
381  }
382 
387  public function withCreatedAt(?DateTimeImmutable $createdAt)
388  {
389  $this->createdAt = $createdAt;
390 
391  return $this;
392  }
393 
398  public function withLastModifiedAt(?DateTimeImmutable $lastModifiedAt)
399  {
400  $this->lastModifiedAt = $lastModifiedAt;
401 
402  return $this;
403  }
404 
409  public function withLastModifiedBy(?LastModifiedBy $lastModifiedBy)
410  {
411  $this->lastModifiedBy = $lastModifiedBy;
412 
413  return $this;
414  }
415 
420  public function withCreatedBy(?CreatedBy $createdBy)
421  {
422  $this->createdBy = $createdBy;
423 
424  return $this;
425  }
426 
431  public function withName(?LocalizedString $name)
432  {
433  $this->name = $name;
434 
435  return $this;
436  }
437 
442  public function withSlug(?LocalizedString $slug)
443  {
444  $this->slug = $slug;
445 
446  return $this;
447  }
448 
453  public function withDescription(?LocalizedString $description)
454  {
455  $this->description = $description;
456 
457  return $this;
458  }
459 
464  public function withAncestors(?CategoryReferenceCollection $ancestors)
465  {
466  $this->ancestors = $ancestors;
467 
468  return $this;
469  }
470 
475  public function withParent(?CategoryReference $parent)
476  {
477  $this->parent = $parent;
478 
479  return $this;
480  }
481 
486  public function withOrderHint(?string $orderHint)
487  {
488  $this->orderHint = $orderHint;
489 
490  return $this;
491  }
492 
497  public function withExternalId(?string $externalId)
498  {
499  $this->externalId = $externalId;
500 
501  return $this;
502  }
503 
508  public function withMetaTitle(?LocalizedString $metaTitle)
509  {
510  $this->metaTitle = $metaTitle;
511 
512  return $this;
513  }
514 
519  public function withMetaDescription(?LocalizedString $metaDescription)
520  {
521  $this->metaDescription = $metaDescription;
522 
523  return $this;
524  }
525 
530  public function withMetaKeywords(?LocalizedString $metaKeywords)
531  {
532  $this->metaKeywords = $metaKeywords;
533 
534  return $this;
535  }
536 
541  public function withCustom(?CustomFields $custom)
542  {
543  $this->custom = $custom;
544 
545  return $this;
546  }
547 
552  public function withAssets(?AssetCollection $assets)
553  {
554  $this->assets = $assets;
555 
556  return $this;
557  }
558 
563  public function withKey(?string $key)
564  {
565  $this->key = $key;
566 
567  return $this;
568  }
569 
574  public function withLastModifiedByBuilder(?LastModifiedByBuilder $lastModifiedBy)
575  {
576  $this->lastModifiedBy = $lastModifiedBy;
577 
578  return $this;
579  }
580 
585  public function withCreatedByBuilder(?CreatedByBuilder $createdBy)
586  {
587  $this->createdBy = $createdBy;
588 
589  return $this;
590  }
591 
596  public function withNameBuilder(?LocalizedStringBuilder $name)
597  {
598  $this->name = $name;
599 
600  return $this;
601  }
602 
607  public function withSlugBuilder(?LocalizedStringBuilder $slug)
608  {
609  $this->slug = $slug;
610 
611  return $this;
612  }
613 
618  public function withDescriptionBuilder(?LocalizedStringBuilder $description)
619  {
620  $this->description = $description;
621 
622  return $this;
623  }
624 
629  public function withParentBuilder(?CategoryReferenceBuilder $parent)
630  {
631  $this->parent = $parent;
632 
633  return $this;
634  }
635 
640  public function withMetaTitleBuilder(?LocalizedStringBuilder $metaTitle)
641  {
642  $this->metaTitle = $metaTitle;
643 
644  return $this;
645  }
646 
651  public function withMetaDescriptionBuilder(?LocalizedStringBuilder $metaDescription)
652  {
653  $this->metaDescription = $metaDescription;
654 
655  return $this;
656  }
657 
662  public function withMetaKeywordsBuilder(?LocalizedStringBuilder $metaKeywords)
663  {
664  $this->metaKeywords = $metaKeywords;
665 
666  return $this;
667  }
668 
673  public function withCustomBuilder(?CustomFieldsBuilder $custom)
674  {
675  $this->custom = $custom;
676 
677  return $this;
678  }
679 
680  public function build(): Category
681  {
682  return new CategoryModel(
683  $this->id,
684  $this->version,
685  $this->createdAt,
686  $this->lastModifiedAt,
687  $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy,
688  $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy,
689  $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name,
690  $this->slug instanceof LocalizedStringBuilder ? $this->slug->build() : $this->slug,
691  $this->description instanceof LocalizedStringBuilder ? $this->description->build() : $this->description,
692  $this->ancestors,
693  $this->parent instanceof CategoryReferenceBuilder ? $this->parent->build() : $this->parent,
694  $this->orderHint,
695  $this->externalId,
696  $this->metaTitle instanceof LocalizedStringBuilder ? $this->metaTitle->build() : $this->metaTitle,
697  $this->metaDescription instanceof LocalizedStringBuilder ? $this->metaDescription->build() : $this->metaDescription,
698  $this->metaKeywords instanceof LocalizedStringBuilder ? $this->metaKeywords->build() : $this->metaKeywords,
699  $this->custom instanceof CustomFieldsBuilder ? $this->custom->build() : $this->custom,
700  $this->assets,
701  $this->key
702  );
703  }
704 
705  public static function of(): CategoryBuilder
706  {
707  return new self();
708  }
709 }
withCreatedByBuilder(?CreatedByBuilder $createdBy)
withMetaKeywords(?LocalizedString $metaKeywords)
withMetaDescription(?LocalizedString $metaDescription)
withMetaTitleBuilder(?LocalizedStringBuilder $metaTitle)
withParentBuilder(?CategoryReferenceBuilder $parent)
withAncestors(?CategoryReferenceCollection $ancestors)
withDescriptionBuilder(?LocalizedStringBuilder $description)
withLastModifiedAt(?DateTimeImmutable $lastModifiedAt)
withMetaDescriptionBuilder(?LocalizedStringBuilder $metaDescription)
withLastModifiedBy(?LastModifiedBy $lastModifiedBy)
withMetaKeywordsBuilder(?LocalizedStringBuilder $metaKeywords)
withLastModifiedByBuilder(?LastModifiedByBuilder $lastModifiedBy)