commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
ProductDraftBuilder.php
1<?php
2
3declare(strict_types=1);
10
25use stdClass;
26
30final class ProductDraftBuilder implements Builder
31{
36 private $productType;
37
42 private $name;
43
48 private $slug;
49
54 private $key;
55
60 private $description;
61
66 private $categories;
67
72 private $categoryOrderHints;
73
78 private $metaTitle;
79
84 private $metaDescription;
85
90 private $metaKeywords;
91
96 private $masterVariant;
97
102 private $variants;
103
108 private $taxCategory;
109
114 private $searchKeywords;
115
120 private $state;
121
126 private $publish;
127
132 private $priceMode;
133
140 public function getProductType()
141 {
142 return $this->productType instanceof ProductTypeResourceIdentifierBuilder ? $this->productType->build() : $this->productType;
143 }
144
151 public function getName()
152 {
153 return $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name;
154 }
155
164 public function getSlug()
165 {
166 return $this->slug instanceof LocalizedStringBuilder ? $this->slug->build() : $this->slug;
167 }
168
177 public function getKey()
178 {
179 return $this->key;
180 }
181
188 public function getDescription()
189 {
190 return $this->description instanceof LocalizedStringBuilder ? $this->description->build() : $this->description;
191 }
192
199 public function getCategories()
200 {
201 return $this->categories;
202 }
203
210 public function getCategoryOrderHints()
211 {
212 return $this->categoryOrderHints instanceof CategoryOrderHintsBuilder ? $this->categoryOrderHints->build() : $this->categoryOrderHints;
213 }
214
221 public function getMetaTitle()
222 {
223 return $this->metaTitle instanceof LocalizedStringBuilder ? $this->metaTitle->build() : $this->metaTitle;
224 }
225
232 public function getMetaDescription()
233 {
234 return $this->metaDescription instanceof LocalizedStringBuilder ? $this->metaDescription->build() : $this->metaDescription;
235 }
236
243 public function getMetaKeywords()
244 {
245 return $this->metaKeywords instanceof LocalizedStringBuilder ? $this->metaKeywords->build() : $this->metaKeywords;
246 }
247
254 public function getMasterVariant()
255 {
256 return $this->masterVariant instanceof ProductVariantDraftBuilder ? $this->masterVariant->build() : $this->masterVariant;
257 }
258
265 public function getVariants()
266 {
267 return $this->variants;
268 }
269
276 public function getTaxCategory()
277 {
278 return $this->taxCategory instanceof TaxCategoryResourceIdentifierBuilder ? $this->taxCategory->build() : $this->taxCategory;
279 }
280
287 public function getSearchKeywords()
288 {
289 return $this->searchKeywords instanceof SearchKeywordsBuilder ? $this->searchKeywords->build() : $this->searchKeywords;
290 }
291
298 public function getState()
299 {
300 return $this->state instanceof StateResourceIdentifierBuilder ? $this->state->build() : $this->state;
301 }
302
309 public function getPublish()
310 {
311 return $this->publish;
312 }
313
320 public function getPriceMode()
321 {
322 return $this->priceMode;
323 }
324
329 public function withProductType(?ProductTypeResourceIdentifier $productType)
330 {
331 $this->productType = $productType;
332
333 return $this;
334 }
335
340 public function withName(?LocalizedString $name)
341 {
342 $this->name = $name;
343
344 return $this;
345 }
346
351 public function withSlug(?LocalizedString $slug)
352 {
353 $this->slug = $slug;
354
355 return $this;
356 }
357
362 public function withKey(?string $key)
363 {
364 $this->key = $key;
365
366 return $this;
367 }
368
373 public function withDescription(?LocalizedString $description)
374 {
375 $this->description = $description;
376
377 return $this;
378 }
379
385 {
386 $this->categories = $categories;
387
388 return $this;
389 }
390
395 public function withCategoryOrderHints(?CategoryOrderHints $categoryOrderHints)
396 {
397 $this->categoryOrderHints = $categoryOrderHints;
398
399 return $this;
400 }
401
406 public function withMetaTitle(?LocalizedString $metaTitle)
407 {
408 $this->metaTitle = $metaTitle;
409
410 return $this;
411 }
412
417 public function withMetaDescription(?LocalizedString $metaDescription)
418 {
419 $this->metaDescription = $metaDescription;
420
421 return $this;
422 }
423
428 public function withMetaKeywords(?LocalizedString $metaKeywords)
429 {
430 $this->metaKeywords = $metaKeywords;
431
432 return $this;
433 }
434
439 public function withMasterVariant(?ProductVariantDraft $masterVariant)
440 {
441 $this->masterVariant = $masterVariant;
442
443 return $this;
444 }
445
450 public function withVariants(?ProductVariantDraftCollection $variants)
451 {
452 $this->variants = $variants;
453
454 return $this;
455 }
456
461 public function withTaxCategory(?TaxCategoryResourceIdentifier $taxCategory)
462 {
463 $this->taxCategory = $taxCategory;
464
465 return $this;
466 }
467
472 public function withSearchKeywords(?SearchKeywords $searchKeywords)
473 {
474 $this->searchKeywords = $searchKeywords;
475
476 return $this;
477 }
478
483 public function withState(?StateResourceIdentifier $state)
484 {
485 $this->state = $state;
486
487 return $this;
488 }
489
494 public function withPublish(?bool $publish)
495 {
496 $this->publish = $publish;
497
498 return $this;
499 }
500
505 public function withPriceMode(?string $priceMode)
506 {
507 $this->priceMode = $priceMode;
508
509 return $this;
510 }
511
517 {
518 $this->productType = $productType;
519
520 return $this;
521 }
522
528 {
529 $this->name = $name;
530
531 return $this;
532 }
533
539 {
540 $this->slug = $slug;
541
542 return $this;
543 }
544
549 public function withDescriptionBuilder(?LocalizedStringBuilder $description)
550 {
551 $this->description = $description;
552
553 return $this;
554 }
555
560 public function withCategoryOrderHintsBuilder(?CategoryOrderHintsBuilder $categoryOrderHints)
561 {
562 $this->categoryOrderHints = $categoryOrderHints;
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(): ProductDraft
645 {
646 return new ProductDraftModel(
647 $this->productType instanceof ProductTypeResourceIdentifierBuilder ? $this->productType->build() : $this->productType,
648 $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name,
649 $this->slug instanceof LocalizedStringBuilder ? $this->slug->build() : $this->slug,
650 $this->key,
651 $this->description instanceof LocalizedStringBuilder ? $this->description->build() : $this->description,
652 $this->categories,
653 $this->categoryOrderHints instanceof CategoryOrderHintsBuilder ? $this->categoryOrderHints->build() : $this->categoryOrderHints,
654 $this->metaTitle instanceof LocalizedStringBuilder ? $this->metaTitle->build() : $this->metaTitle,
655 $this->metaDescription instanceof LocalizedStringBuilder ? $this->metaDescription->build() : $this->metaDescription,
656 $this->metaKeywords instanceof LocalizedStringBuilder ? $this->metaKeywords->build() : $this->metaKeywords,
657 $this->masterVariant instanceof ProductVariantDraftBuilder ? $this->masterVariant->build() : $this->masterVariant,
658 $this->variants,
659 $this->taxCategory instanceof TaxCategoryResourceIdentifierBuilder ? $this->taxCategory->build() : $this->taxCategory,
660 $this->searchKeywords instanceof SearchKeywordsBuilder ? $this->searchKeywords->build() : $this->searchKeywords,
661 $this->state instanceof StateResourceIdentifierBuilder ? $this->state->build() : $this->state,
662 $this->publish,
663 $this->priceMode
664 );
665 }
666
667 public static function of(): ProductDraftBuilder
668 {
669 return new self();
670 }
671}
withCategoryOrderHints(?CategoryOrderHints $categoryOrderHints)
withProductType(?ProductTypeResourceIdentifier $productType)
withMasterVariant(?ProductVariantDraft $masterVariant)
withTaxCategory(?TaxCategoryResourceIdentifier $taxCategory)
withDescriptionBuilder(?LocalizedStringBuilder $description)
withTaxCategoryBuilder(?TaxCategoryResourceIdentifierBuilder $taxCategory)
withSearchKeywordsBuilder(?SearchKeywordsBuilder $searchKeywords)
withProductTypeBuilder(?ProductTypeResourceIdentifierBuilder $productType)
withVariants(?ProductVariantDraftCollection $variants)
withMetaTitleBuilder(?LocalizedStringBuilder $metaTitle)
withStateBuilder(?StateResourceIdentifierBuilder $state)
withMasterVariantBuilder(?ProductVariantDraftBuilder $masterVariant)
withMetaKeywordsBuilder(?LocalizedStringBuilder $metaKeywords)
withMetaDescriptionBuilder(?LocalizedStringBuilder $metaDescription)
withCategories(?CategoryResourceIdentifierCollection $categories)
withCategoryOrderHintsBuilder(?CategoryOrderHintsBuilder $categoryOrderHints)