commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
ProductProjectionBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
29 use DateTimeImmutable;
30 use stdClass;
31 
35 final class ProductProjectionBuilder implements Builder
36 {
41  private $id;
42 
47  private $version;
48 
53  private $createdAt;
54 
59  private $lastModifiedAt;
60 
65  private $key;
66 
71  private $productType;
72 
77  private $name;
78 
83  private $description;
84 
89  private $slug;
90 
95  private $categories;
96 
101  private $categoryOrderHints;
102 
107  private $metaTitle;
108 
113  private $metaDescription;
114 
119  private $metaKeywords;
120 
125  private $searchKeywords;
126 
131  private $hasStagedChanges;
132 
137  private $published;
138 
143  private $masterVariant;
144 
149  private $variants;
150 
155  private $taxCategory;
156 
161  private $state;
162 
167  private $reviewRatingStatistics;
168 
173  private $priceMode;
174 
181  public function getId()
182  {
183  return $this->id;
184  }
185 
192  public function getVersion()
193  {
194  return $this->version;
195  }
196 
203  public function getCreatedAt()
204  {
205  return $this->createdAt;
206  }
207 
214  public function getLastModifiedAt()
215  {
216  return $this->lastModifiedAt;
217  }
218 
225  public function getKey()
226  {
227  return $this->key;
228  }
229 
236  public function getProductType()
237  {
238  return $this->productType instanceof ProductTypeReferenceBuilder ? $this->productType->build() : $this->productType;
239  }
240 
247  public function getName()
248  {
249  return $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name;
250  }
251 
258  public function getDescription()
259  {
260  return $this->description instanceof LocalizedStringBuilder ? $this->description->build() : $this->description;
261  }
262 
272  public function getSlug()
273  {
274  return $this->slug instanceof LocalizedStringBuilder ? $this->slug->build() : $this->slug;
275  }
276 
283  public function getCategories()
284  {
285  return $this->categories;
286  }
287 
294  public function getCategoryOrderHints()
295  {
296  return $this->categoryOrderHints instanceof CategoryOrderHintsBuilder ? $this->categoryOrderHints->build() : $this->categoryOrderHints;
297  }
298 
305  public function getMetaTitle()
306  {
307  return $this->metaTitle instanceof LocalizedStringBuilder ? $this->metaTitle->build() : $this->metaTitle;
308  }
309 
316  public function getMetaDescription()
317  {
318  return $this->metaDescription instanceof LocalizedStringBuilder ? $this->metaDescription->build() : $this->metaDescription;
319  }
320 
327  public function getMetaKeywords()
328  {
329  return $this->metaKeywords instanceof LocalizedStringBuilder ? $this->metaKeywords->build() : $this->metaKeywords;
330  }
331 
338  public function getSearchKeywords()
339  {
340  return $this->searchKeywords instanceof SearchKeywordsBuilder ? $this->searchKeywords->build() : $this->searchKeywords;
341  }
342 
349  public function getHasStagedChanges()
350  {
351  return $this->hasStagedChanges;
352  }
353 
360  public function getPublished()
361  {
362  return $this->published;
363  }
364 
371  public function getMasterVariant()
372  {
373  return $this->masterVariant instanceof ProductVariantBuilder ? $this->masterVariant->build() : $this->masterVariant;
374  }
375 
382  public function getVariants()
383  {
384  return $this->variants;
385  }
386 
393  public function getTaxCategory()
394  {
395  return $this->taxCategory instanceof TaxCategoryReferenceBuilder ? $this->taxCategory->build() : $this->taxCategory;
396  }
397 
404  public function getState()
405  {
406  return $this->state instanceof StateReferenceBuilder ? $this->state->build() : $this->state;
407  }
408 
415  public function getReviewRatingStatistics()
416  {
417  return $this->reviewRatingStatistics instanceof ReviewRatingStatisticsBuilder ? $this->reviewRatingStatistics->build() : $this->reviewRatingStatistics;
418  }
419 
426  public function getPriceMode()
427  {
428  return $this->priceMode;
429  }
430 
435  public function withId(?string $id)
436  {
437  $this->id = $id;
438 
439  return $this;
440  }
441 
446  public function withVersion(?int $version)
447  {
448  $this->version = $version;
449 
450  return $this;
451  }
452 
457  public function withCreatedAt(?DateTimeImmutable $createdAt)
458  {
459  $this->createdAt = $createdAt;
460 
461  return $this;
462  }
463 
468  public function withLastModifiedAt(?DateTimeImmutable $lastModifiedAt)
469  {
470  $this->lastModifiedAt = $lastModifiedAt;
471 
472  return $this;
473  }
474 
479  public function withKey(?string $key)
480  {
481  $this->key = $key;
482 
483  return $this;
484  }
485 
490  public function withProductType(?ProductTypeReference $productType)
491  {
492  $this->productType = $productType;
493 
494  return $this;
495  }
496 
501  public function withName(?LocalizedString $name)
502  {
503  $this->name = $name;
504 
505  return $this;
506  }
507 
512  public function withDescription(?LocalizedString $description)
513  {
514  $this->description = $description;
515 
516  return $this;
517  }
518 
523  public function withSlug(?LocalizedString $slug)
524  {
525  $this->slug = $slug;
526 
527  return $this;
528  }
529 
534  public function withCategories(?CategoryReferenceCollection $categories)
535  {
536  $this->categories = $categories;
537 
538  return $this;
539  }
540 
545  public function withCategoryOrderHints(?CategoryOrderHints $categoryOrderHints)
546  {
547  $this->categoryOrderHints = $categoryOrderHints;
548 
549  return $this;
550  }
551 
556  public function withMetaTitle(?LocalizedString $metaTitle)
557  {
558  $this->metaTitle = $metaTitle;
559 
560  return $this;
561  }
562 
567  public function withMetaDescription(?LocalizedString $metaDescription)
568  {
569  $this->metaDescription = $metaDescription;
570 
571  return $this;
572  }
573 
578  public function withMetaKeywords(?LocalizedString $metaKeywords)
579  {
580  $this->metaKeywords = $metaKeywords;
581 
582  return $this;
583  }
584 
589  public function withSearchKeywords(?SearchKeywords $searchKeywords)
590  {
591  $this->searchKeywords = $searchKeywords;
592 
593  return $this;
594  }
595 
600  public function withHasStagedChanges(?bool $hasStagedChanges)
601  {
602  $this->hasStagedChanges = $hasStagedChanges;
603 
604  return $this;
605  }
606 
611  public function withPublished(?bool $published)
612  {
613  $this->published = $published;
614 
615  return $this;
616  }
617 
622  public function withMasterVariant(?ProductVariant $masterVariant)
623  {
624  $this->masterVariant = $masterVariant;
625 
626  return $this;
627  }
628 
633  public function withVariants(?ProductVariantCollection $variants)
634  {
635  $this->variants = $variants;
636 
637  return $this;
638  }
639 
644  public function withTaxCategory(?TaxCategoryReference $taxCategory)
645  {
646  $this->taxCategory = $taxCategory;
647 
648  return $this;
649  }
650 
655  public function withState(?StateReference $state)
656  {
657  $this->state = $state;
658 
659  return $this;
660  }
661 
666  public function withReviewRatingStatistics(?ReviewRatingStatistics $reviewRatingStatistics)
667  {
668  $this->reviewRatingStatistics = $reviewRatingStatistics;
669 
670  return $this;
671  }
672 
677  public function withPriceMode(?string $priceMode)
678  {
679  $this->priceMode = $priceMode;
680 
681  return $this;
682  }
683 
689  {
690  $this->productType = $productType;
691 
692  return $this;
693  }
694 
699  public function withNameBuilder(?LocalizedStringBuilder $name)
700  {
701  $this->name = $name;
702 
703  return $this;
704  }
705 
710  public function withDescriptionBuilder(?LocalizedStringBuilder $description)
711  {
712  $this->description = $description;
713 
714  return $this;
715  }
716 
721  public function withSlugBuilder(?LocalizedStringBuilder $slug)
722  {
723  $this->slug = $slug;
724 
725  return $this;
726  }
727 
732  public function withCategoryOrderHintsBuilder(?CategoryOrderHintsBuilder $categoryOrderHints)
733  {
734  $this->categoryOrderHints = $categoryOrderHints;
735 
736  return $this;
737  }
738 
743  public function withMetaTitleBuilder(?LocalizedStringBuilder $metaTitle)
744  {
745  $this->metaTitle = $metaTitle;
746 
747  return $this;
748  }
749 
754  public function withMetaDescriptionBuilder(?LocalizedStringBuilder $metaDescription)
755  {
756  $this->metaDescription = $metaDescription;
757 
758  return $this;
759  }
760 
765  public function withMetaKeywordsBuilder(?LocalizedStringBuilder $metaKeywords)
766  {
767  $this->metaKeywords = $metaKeywords;
768 
769  return $this;
770  }
771 
776  public function withSearchKeywordsBuilder(?SearchKeywordsBuilder $searchKeywords)
777  {
778  $this->searchKeywords = $searchKeywords;
779 
780  return $this;
781  }
782 
787  public function withMasterVariantBuilder(?ProductVariantBuilder $masterVariant)
788  {
789  $this->masterVariant = $masterVariant;
790 
791  return $this;
792  }
793 
799  {
800  $this->taxCategory = $taxCategory;
801 
802  return $this;
803  }
804 
809  public function withStateBuilder(?StateReferenceBuilder $state)
810  {
811  $this->state = $state;
812 
813  return $this;
814  }
815 
820  public function withReviewRatingStatisticsBuilder(?ReviewRatingStatisticsBuilder $reviewRatingStatistics)
821  {
822  $this->reviewRatingStatistics = $reviewRatingStatistics;
823 
824  return $this;
825  }
826 
827  public function build(): ProductProjection
828  {
829  return new ProductProjectionModel(
830  $this->id,
831  $this->version,
832  $this->createdAt,
833  $this->lastModifiedAt,
834  $this->key,
835  $this->productType instanceof ProductTypeReferenceBuilder ? $this->productType->build() : $this->productType,
836  $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name,
837  $this->description instanceof LocalizedStringBuilder ? $this->description->build() : $this->description,
838  $this->slug instanceof LocalizedStringBuilder ? $this->slug->build() : $this->slug,
839  $this->categories,
840  $this->categoryOrderHints instanceof CategoryOrderHintsBuilder ? $this->categoryOrderHints->build() : $this->categoryOrderHints,
841  $this->metaTitle instanceof LocalizedStringBuilder ? $this->metaTitle->build() : $this->metaTitle,
842  $this->metaDescription instanceof LocalizedStringBuilder ? $this->metaDescription->build() : $this->metaDescription,
843  $this->metaKeywords instanceof LocalizedStringBuilder ? $this->metaKeywords->build() : $this->metaKeywords,
844  $this->searchKeywords instanceof SearchKeywordsBuilder ? $this->searchKeywords->build() : $this->searchKeywords,
845  $this->hasStagedChanges,
846  $this->published,
847  $this->masterVariant instanceof ProductVariantBuilder ? $this->masterVariant->build() : $this->masterVariant,
848  $this->variants,
849  $this->taxCategory instanceof TaxCategoryReferenceBuilder ? $this->taxCategory->build() : $this->taxCategory,
850  $this->state instanceof StateReferenceBuilder ? $this->state->build() : $this->state,
851  $this->reviewRatingStatistics instanceof ReviewRatingStatisticsBuilder ? $this->reviewRatingStatistics->build() : $this->reviewRatingStatistics,
852  $this->priceMode
853  );
854  }
855 
856  public static function of(): ProductProjectionBuilder
857  {
858  return new self();
859  }
860 }
withReviewRatingStatistics(?ReviewRatingStatistics $reviewRatingStatistics)
withCategoryOrderHints(?CategoryOrderHints $categoryOrderHints)
withMetaDescriptionBuilder(?LocalizedStringBuilder $metaDescription)
withReviewRatingStatisticsBuilder(?ReviewRatingStatisticsBuilder $reviewRatingStatistics)
withProductTypeBuilder(?ProductTypeReferenceBuilder $productType)
withTaxCategoryBuilder(?TaxCategoryReferenceBuilder $taxCategory)
withCategoryOrderHintsBuilder(?CategoryOrderHintsBuilder $categoryOrderHints)
withSearchKeywordsBuilder(?SearchKeywordsBuilder $searchKeywords)