commercetools-sdk-php-v2  master
The platform, import-api and ml-api PHP sdks generated from our api reference.
ProductDraftImportBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
29 use stdClass;
30 
34 final class ProductDraftImportBuilder implements Builder
35 {
40  private $key;
41 
46  private $productType;
47 
52  private $name;
53 
58  private $slug;
59 
64  private $description;
65 
70  private $categories;
71 
76  private $metaTitle;
77 
82  private $metaDescription;
83 
88  private $metaKeywords;
89 
94  private $masterVariant;
95 
100  private $variants;
101 
106  private $taxCategory;
107 
112  private $searchKeywords;
113 
118  private $state;
119 
124  private $publish;
125 
130  private $priceMode;
131 
138  public function getKey()
139  {
140  return $this->key;
141  }
142 
152  public function getProductType()
153  {
154  return $this->productType instanceof ProductTypeKeyReferenceBuilder ? $this->productType->build() : $this->productType;
155  }
156 
161  public function getName()
162  {
163  return $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name;
164  }
165 
173  public function getSlug()
174  {
175  return $this->slug instanceof LocalizedStringBuilder ? $this->slug->build() : $this->slug;
176  }
177 
184  public function getDescription()
185  {
186  return $this->description instanceof LocalizedStringBuilder ? $this->description->build() : $this->description;
187  }
188 
196  public function getCategories()
197  {
198  return $this->categories;
199  }
200 
212  public function getMetaTitle()
213  {
214  return $this->metaTitle instanceof LocalizedStringBuilder ? $this->metaTitle->build() : $this->metaTitle;
215  }
216 
228  public function getMetaDescription()
229  {
230  return $this->metaDescription instanceof LocalizedStringBuilder ? $this->metaDescription->build() : $this->metaDescription;
231  }
232 
244  public function getMetaKeywords()
245  {
246  return $this->metaKeywords instanceof LocalizedStringBuilder ? $this->metaKeywords->build() : $this->metaKeywords;
247  }
248 
256  public function getMasterVariant()
257  {
258  return $this->masterVariant instanceof ProductVariantDraftImportBuilder ? $this->masterVariant->build() : $this->masterVariant;
259  }
260 
267  public function getVariants()
268  {
269  return $this->variants;
270  }
271 
279  public function getTaxCategory()
280  {
281  return $this->taxCategory instanceof TaxCategoryKeyReferenceBuilder ? $this->taxCategory->build() : $this->taxCategory;
282  }
283 
306  public function getSearchKeywords()
307  {
308  return $this->searchKeywords instanceof SearchKeywordsBuilder ? $this->searchKeywords->build() : $this->searchKeywords;
309  }
310 
318  public function getState()
319  {
320  return $this->state instanceof StateKeyReferenceBuilder ? $this->state->build() : $this->state;
321  }
322 
331  public function getPublish()
332  {
333  return $this->publish;
334  }
335 
342  public function getPriceMode()
343  {
344  return $this->priceMode;
345  }
346 
351  public function withKey(?string $key)
352  {
353  $this->key = $key;
354 
355  return $this;
356  }
357 
362  public function withProductType(?ProductTypeKeyReference $productType)
363  {
364  $this->productType = $productType;
365 
366  return $this;
367  }
368 
373  public function withName(?LocalizedString $name)
374  {
375  $this->name = $name;
376 
377  return $this;
378  }
379 
384  public function withSlug(?LocalizedString $slug)
385  {
386  $this->slug = $slug;
387 
388  return $this;
389  }
390 
395  public function withDescription(?LocalizedString $description)
396  {
397  $this->description = $description;
398 
399  return $this;
400  }
401 
406  public function withCategories(?CategoryKeyReferenceCollection $categories)
407  {
408  $this->categories = $categories;
409 
410  return $this;
411  }
412 
417  public function withMetaTitle(?LocalizedString $metaTitle)
418  {
419  $this->metaTitle = $metaTitle;
420 
421  return $this;
422  }
423 
428  public function withMetaDescription(?LocalizedString $metaDescription)
429  {
430  $this->metaDescription = $metaDescription;
431 
432  return $this;
433  }
434 
439  public function withMetaKeywords(?LocalizedString $metaKeywords)
440  {
441  $this->metaKeywords = $metaKeywords;
442 
443  return $this;
444  }
445 
450  public function withMasterVariant(?ProductVariantDraftImport $masterVariant)
451  {
452  $this->masterVariant = $masterVariant;
453 
454  return $this;
455  }
456 
462  {
463  $this->variants = $variants;
464 
465  return $this;
466  }
467 
472  public function withTaxCategory(?TaxCategoryKeyReference $taxCategory)
473  {
474  $this->taxCategory = $taxCategory;
475 
476  return $this;
477  }
478 
483  public function withSearchKeywords(?SearchKeywords $searchKeywords)
484  {
485  $this->searchKeywords = $searchKeywords;
486 
487  return $this;
488  }
489 
494  public function withState(?StateKeyReference $state)
495  {
496  $this->state = $state;
497 
498  return $this;
499  }
500 
505  public function withPublish(?bool $publish)
506  {
507  $this->publish = $publish;
508 
509  return $this;
510  }
511 
516  public function withPriceMode(?string $priceMode)
517  {
518  $this->priceMode = $priceMode;
519 
520  return $this;
521  }
522 
528  {
529  $this->productType = $productType;
530 
531  return $this;
532  }
533 
538  public function withNameBuilder(?LocalizedStringBuilder $name)
539  {
540  $this->name = $name;
541 
542  return $this;
543  }
544 
549  public function withSlugBuilder(?LocalizedStringBuilder $slug)
550  {
551  $this->slug = $slug;
552 
553  return $this;
554  }
555 
560  public function withDescriptionBuilder(?LocalizedStringBuilder $description)
561  {
562  $this->description = $description;
563 
564  return $this;
565  }
566 
571  public function withMetaTitleBuilder(?LocalizedStringBuilder $metaTitle)
572  {
573  $this->metaTitle = $metaTitle;
574 
575  return $this;
576  }
577 
582  public function withMetaDescriptionBuilder(?LocalizedStringBuilder $metaDescription)
583  {
584  $this->metaDescription = $metaDescription;
585 
586  return $this;
587  }
588 
593  public function withMetaKeywordsBuilder(?LocalizedStringBuilder $metaKeywords)
594  {
595  $this->metaKeywords = $metaKeywords;
596 
597  return $this;
598  }
599 
605  {
606  $this->masterVariant = $masterVariant;
607 
608  return $this;
609  }
610 
616  {
617  $this->taxCategory = $taxCategory;
618 
619  return $this;
620  }
621 
626  public function withSearchKeywordsBuilder(?SearchKeywordsBuilder $searchKeywords)
627  {
628  $this->searchKeywords = $searchKeywords;
629 
630  return $this;
631  }
632 
638  {
639  $this->state = $state;
640 
641  return $this;
642  }
643 
644  public function build(): ProductDraftImport
645  {
646  return new ProductDraftImportModel(
647  $this->key,
648  $this->productType instanceof ProductTypeKeyReferenceBuilder ? $this->productType->build() : $this->productType,
649  $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name,
650  $this->slug instanceof LocalizedStringBuilder ? $this->slug->build() : $this->slug,
651  $this->description instanceof LocalizedStringBuilder ? $this->description->build() : $this->description,
652  $this->categories,
653  $this->metaTitle instanceof LocalizedStringBuilder ? $this->metaTitle->build() : $this->metaTitle,
654  $this->metaDescription instanceof LocalizedStringBuilder ? $this->metaDescription->build() : $this->metaDescription,
655  $this->metaKeywords instanceof LocalizedStringBuilder ? $this->metaKeywords->build() : $this->metaKeywords,
656  $this->masterVariant instanceof ProductVariantDraftImportBuilder ? $this->masterVariant->build() : $this->masterVariant,
657  $this->variants,
658  $this->taxCategory instanceof TaxCategoryKeyReferenceBuilder ? $this->taxCategory->build() : $this->taxCategory,
659  $this->searchKeywords instanceof SearchKeywordsBuilder ? $this->searchKeywords->build() : $this->searchKeywords,
660  $this->state instanceof StateKeyReferenceBuilder ? $this->state->build() : $this->state,
661  $this->publish,
662  $this->priceMode
663  );
664  }
665 
666  public static function of(): ProductDraftImportBuilder
667  {
668  return new self();
669  }
670 }
withMasterVariantBuilder(?ProductVariantDraftImportBuilder $masterVariant)