commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
ProductImportBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
27 use stdClass;
28 
32 final class ProductImportBuilder implements Builder
33 {
38  private $key;
39 
44  private $name;
45 
50  private $productType;
51 
56  private $slug;
57 
62  private $description;
63 
68  private $categories;
69 
74  private $metaTitle;
75 
80  private $metaDescription;
81 
86  private $metaKeywords;
87 
92  private $taxCategory;
93 
98  private $searchKeywords;
99 
104  private $state;
105 
110  private $publish;
111 
116  private $priceMode;
117 
124  public function getKey()
125  {
126  return $this->key;
127  }
128 
135  public function getName()
136  {
137  return $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name;
138  }
139 
149  public function getProductType()
150  {
151  return $this->productType instanceof ProductTypeKeyReferenceBuilder ? $this->productType->build() : $this->productType;
152  }
153 
161  public function getSlug()
162  {
163  return $this->slug instanceof LocalizedStringBuilder ? $this->slug->build() : $this->slug;
164  }
165 
172  public function getDescription()
173  {
174  return $this->description instanceof LocalizedStringBuilder ? $this->description->build() : $this->description;
175  }
176 
185  public function getCategories()
186  {
187  return $this->categories;
188  }
189 
201  public function getMetaTitle()
202  {
203  return $this->metaTitle instanceof LocalizedStringBuilder ? $this->metaTitle->build() : $this->metaTitle;
204  }
205 
217  public function getMetaDescription()
218  {
219  return $this->metaDescription instanceof LocalizedStringBuilder ? $this->metaDescription->build() : $this->metaDescription;
220  }
221 
233  public function getMetaKeywords()
234  {
235  return $this->metaKeywords instanceof LocalizedStringBuilder ? $this->metaKeywords->build() : $this->metaKeywords;
236  }
237 
245  public function getTaxCategory()
246  {
247  return $this->taxCategory instanceof TaxCategoryKeyReferenceBuilder ? $this->taxCategory->build() : $this->taxCategory;
248  }
249 
272  public function getSearchKeywords()
273  {
274  return $this->searchKeywords instanceof SearchKeywordsBuilder ? $this->searchKeywords->build() : $this->searchKeywords;
275  }
276 
284  public function getState()
285  {
286  return $this->state instanceof StateKeyReferenceBuilder ? $this->state->build() : $this->state;
287  }
288 
295  public function getPublish()
296  {
297  return $this->publish;
298  }
299 
306  public function getPriceMode()
307  {
308  return $this->priceMode;
309  }
310 
315  public function withKey(?string $key)
316  {
317  $this->key = $key;
318 
319  return $this;
320  }
321 
326  public function withName(?LocalizedString $name)
327  {
328  $this->name = $name;
329 
330  return $this;
331  }
332 
337  public function withProductType(?ProductTypeKeyReference $productType)
338  {
339  $this->productType = $productType;
340 
341  return $this;
342  }
343 
348  public function withSlug(?LocalizedString $slug)
349  {
350  $this->slug = $slug;
351 
352  return $this;
353  }
354 
359  public function withDescription(?LocalizedString $description)
360  {
361  $this->description = $description;
362 
363  return $this;
364  }
365 
370  public function withCategories(?CategoryKeyReferenceCollection $categories)
371  {
372  $this->categories = $categories;
373 
374  return $this;
375  }
376 
381  public function withMetaTitle(?LocalizedString $metaTitle)
382  {
383  $this->metaTitle = $metaTitle;
384 
385  return $this;
386  }
387 
392  public function withMetaDescription(?LocalizedString $metaDescription)
393  {
394  $this->metaDescription = $metaDescription;
395 
396  return $this;
397  }
398 
403  public function withMetaKeywords(?LocalizedString $metaKeywords)
404  {
405  $this->metaKeywords = $metaKeywords;
406 
407  return $this;
408  }
409 
414  public function withTaxCategory(?TaxCategoryKeyReference $taxCategory)
415  {
416  $this->taxCategory = $taxCategory;
417 
418  return $this;
419  }
420 
425  public function withSearchKeywords(?SearchKeywords $searchKeywords)
426  {
427  $this->searchKeywords = $searchKeywords;
428 
429  return $this;
430  }
431 
436  public function withState(?StateKeyReference $state)
437  {
438  $this->state = $state;
439 
440  return $this;
441  }
442 
447  public function withPublish(?bool $publish)
448  {
449  $this->publish = $publish;
450 
451  return $this;
452  }
453 
458  public function withPriceMode(?string $priceMode)
459  {
460  $this->priceMode = $priceMode;
461 
462  return $this;
463  }
464 
469  public function withNameBuilder(?LocalizedStringBuilder $name)
470  {
471  $this->name = $name;
472 
473  return $this;
474  }
475 
481  {
482  $this->productType = $productType;
483 
484  return $this;
485  }
486 
491  public function withSlugBuilder(?LocalizedStringBuilder $slug)
492  {
493  $this->slug = $slug;
494 
495  return $this;
496  }
497 
502  public function withDescriptionBuilder(?LocalizedStringBuilder $description)
503  {
504  $this->description = $description;
505 
506  return $this;
507  }
508 
513  public function withMetaTitleBuilder(?LocalizedStringBuilder $metaTitle)
514  {
515  $this->metaTitle = $metaTitle;
516 
517  return $this;
518  }
519 
524  public function withMetaDescriptionBuilder(?LocalizedStringBuilder $metaDescription)
525  {
526  $this->metaDescription = $metaDescription;
527 
528  return $this;
529  }
530 
535  public function withMetaKeywordsBuilder(?LocalizedStringBuilder $metaKeywords)
536  {
537  $this->metaKeywords = $metaKeywords;
538 
539  return $this;
540  }
541 
547  {
548  $this->taxCategory = $taxCategory;
549 
550  return $this;
551  }
552 
557  public function withSearchKeywordsBuilder(?SearchKeywordsBuilder $searchKeywords)
558  {
559  $this->searchKeywords = $searchKeywords;
560 
561  return $this;
562  }
563 
569  {
570  $this->state = $state;
571 
572  return $this;
573  }
574 
575  public function build(): ProductImport
576  {
577  return new ProductImportModel(
578  $this->key,
579  $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name,
580  $this->productType instanceof ProductTypeKeyReferenceBuilder ? $this->productType->build() : $this->productType,
581  $this->slug instanceof LocalizedStringBuilder ? $this->slug->build() : $this->slug,
582  $this->description instanceof LocalizedStringBuilder ? $this->description->build() : $this->description,
583  $this->categories,
584  $this->metaTitle instanceof LocalizedStringBuilder ? $this->metaTitle->build() : $this->metaTitle,
585  $this->metaDescription instanceof LocalizedStringBuilder ? $this->metaDescription->build() : $this->metaDescription,
586  $this->metaKeywords instanceof LocalizedStringBuilder ? $this->metaKeywords->build() : $this->metaKeywords,
587  $this->taxCategory instanceof TaxCategoryKeyReferenceBuilder ? $this->taxCategory->build() : $this->taxCategory,
588  $this->searchKeywords instanceof SearchKeywordsBuilder ? $this->searchKeywords->build() : $this->searchKeywords,
589  $this->state instanceof StateKeyReferenceBuilder ? $this->state->build() : $this->state,
590  $this->publish,
591  $this->priceMode
592  );
593  }
594 
595  public static function of(): ProductImportBuilder
596  {
597  return new self();
598  }
599 }
withMetaKeywordsBuilder(?LocalizedStringBuilder $metaKeywords)
withMetaDescriptionBuilder(?LocalizedStringBuilder $metaDescription)
withSearchKeywordsBuilder(?SearchKeywordsBuilder $searchKeywords)
withTaxCategoryBuilder(?TaxCategoryKeyReferenceBuilder $taxCategory)
withDescriptionBuilder(?LocalizedStringBuilder $description)
withCategories(?CategoryKeyReferenceCollection $categories)
withProductTypeBuilder(?ProductTypeKeyReferenceBuilder $productType)