commercetools-sdk-php-v2  master
The platform, import-api and ml-api 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 
297  public function getPublish()
298  {
299  return $this->publish;
300  }
301 
308  public function getPriceMode()
309  {
310  return $this->priceMode;
311  }
312 
317  public function withKey(?string $key)
318  {
319  $this->key = $key;
320 
321  return $this;
322  }
323 
328  public function withName(?LocalizedString $name)
329  {
330  $this->name = $name;
331 
332  return $this;
333  }
334 
339  public function withProductType(?ProductTypeKeyReference $productType)
340  {
341  $this->productType = $productType;
342 
343  return $this;
344  }
345 
350  public function withSlug(?LocalizedString $slug)
351  {
352  $this->slug = $slug;
353 
354  return $this;
355  }
356 
361  public function withDescription(?LocalizedString $description)
362  {
363  $this->description = $description;
364 
365  return $this;
366  }
367 
372  public function withCategories(?CategoryKeyReferenceCollection $categories)
373  {
374  $this->categories = $categories;
375 
376  return $this;
377  }
378 
383  public function withMetaTitle(?LocalizedString $metaTitle)
384  {
385  $this->metaTitle = $metaTitle;
386 
387  return $this;
388  }
389 
394  public function withMetaDescription(?LocalizedString $metaDescription)
395  {
396  $this->metaDescription = $metaDescription;
397 
398  return $this;
399  }
400 
405  public function withMetaKeywords(?LocalizedString $metaKeywords)
406  {
407  $this->metaKeywords = $metaKeywords;
408 
409  return $this;
410  }
411 
416  public function withTaxCategory(?TaxCategoryKeyReference $taxCategory)
417  {
418  $this->taxCategory = $taxCategory;
419 
420  return $this;
421  }
422 
427  public function withSearchKeywords(?SearchKeywords $searchKeywords)
428  {
429  $this->searchKeywords = $searchKeywords;
430 
431  return $this;
432  }
433 
438  public function withState(?StateKeyReference $state)
439  {
440  $this->state = $state;
441 
442  return $this;
443  }
444 
449  public function withPublish(?bool $publish)
450  {
451  $this->publish = $publish;
452 
453  return $this;
454  }
455 
460  public function withPriceMode(?string $priceMode)
461  {
462  $this->priceMode = $priceMode;
463 
464  return $this;
465  }
466 
471  public function withNameBuilder(?LocalizedStringBuilder $name)
472  {
473  $this->name = $name;
474 
475  return $this;
476  }
477 
483  {
484  $this->productType = $productType;
485 
486  return $this;
487  }
488 
493  public function withSlugBuilder(?LocalizedStringBuilder $slug)
494  {
495  $this->slug = $slug;
496 
497  return $this;
498  }
499 
504  public function withDescriptionBuilder(?LocalizedStringBuilder $description)
505  {
506  $this->description = $description;
507 
508  return $this;
509  }
510 
515  public function withMetaTitleBuilder(?LocalizedStringBuilder $metaTitle)
516  {
517  $this->metaTitle = $metaTitle;
518 
519  return $this;
520  }
521 
526  public function withMetaDescriptionBuilder(?LocalizedStringBuilder $metaDescription)
527  {
528  $this->metaDescription = $metaDescription;
529 
530  return $this;
531  }
532 
537  public function withMetaKeywordsBuilder(?LocalizedStringBuilder $metaKeywords)
538  {
539  $this->metaKeywords = $metaKeywords;
540 
541  return $this;
542  }
543 
549  {
550  $this->taxCategory = $taxCategory;
551 
552  return $this;
553  }
554 
559  public function withSearchKeywordsBuilder(?SearchKeywordsBuilder $searchKeywords)
560  {
561  $this->searchKeywords = $searchKeywords;
562 
563  return $this;
564  }
565 
571  {
572  $this->state = $state;
573 
574  return $this;
575  }
576 
577  public function build(): ProductImport
578  {
579  return new ProductImportModel(
580  $this->key,
581  $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name,
582  $this->productType instanceof ProductTypeKeyReferenceBuilder ? $this->productType->build() : $this->productType,
583  $this->slug instanceof LocalizedStringBuilder ? $this->slug->build() : $this->slug,
584  $this->description instanceof LocalizedStringBuilder ? $this->description->build() : $this->description,
585  $this->categories,
586  $this->metaTitle instanceof LocalizedStringBuilder ? $this->metaTitle->build() : $this->metaTitle,
587  $this->metaDescription instanceof LocalizedStringBuilder ? $this->metaDescription->build() : $this->metaDescription,
588  $this->metaKeywords instanceof LocalizedStringBuilder ? $this->metaKeywords->build() : $this->metaKeywords,
589  $this->taxCategory instanceof TaxCategoryKeyReferenceBuilder ? $this->taxCategory->build() : $this->taxCategory,
590  $this->searchKeywords instanceof SearchKeywordsBuilder ? $this->searchKeywords->build() : $this->searchKeywords,
591  $this->state instanceof StateKeyReferenceBuilder ? $this->state->build() : $this->state,
592  $this->publish,
593  $this->priceMode
594  );
595  }
596 
597  public static function of(): ProductImportBuilder
598  {
599  return new self();
600  }
601 }
withMetaKeywordsBuilder(?LocalizedStringBuilder $metaKeywords)
withMetaDescriptionBuilder(?LocalizedStringBuilder $metaDescription)
withSearchKeywordsBuilder(?SearchKeywordsBuilder $searchKeywords)
withTaxCategoryBuilder(?TaxCategoryKeyReferenceBuilder $taxCategory)
withDescriptionBuilder(?LocalizedStringBuilder $description)
withCategories(?CategoryKeyReferenceCollection $categories)
withProductTypeBuilder(?ProductTypeKeyReferenceBuilder $productType)