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
138 private $attributes;
139
146 public function getProductType()
147 {
148 return $this->productType instanceof ProductTypeResourceIdentifierBuilder ? $this->productType->build() : $this->productType;
149 }
150
157 public function getName()
158 {
159 return $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name;
160 }
161
170 public function getSlug()
171 {
172 return $this->slug instanceof LocalizedStringBuilder ? $this->slug->build() : $this->slug;
173 }
174
182 public function getKey()
183 {
184 return $this->key;
185 }
186
193 public function getDescription()
194 {
195 return $this->description instanceof LocalizedStringBuilder ? $this->description->build() : $this->description;
196 }
197
204 public function getCategories()
205 {
206 return $this->categories;
207 }
208
215 public function getCategoryOrderHints()
216 {
217 return $this->categoryOrderHints instanceof CategoryOrderHintsBuilder ? $this->categoryOrderHints->build() : $this->categoryOrderHints;
218 }
219
226 public function getMetaTitle()
227 {
228 return $this->metaTitle instanceof LocalizedStringBuilder ? $this->metaTitle->build() : $this->metaTitle;
229 }
230
237 public function getMetaDescription()
238 {
239 return $this->metaDescription instanceof LocalizedStringBuilder ? $this->metaDescription->build() : $this->metaDescription;
240 }
241
248 public function getMetaKeywords()
249 {
250 return $this->metaKeywords instanceof LocalizedStringBuilder ? $this->metaKeywords->build() : $this->metaKeywords;
251 }
252
260 public function getMasterVariant()
261 {
262 return $this->masterVariant instanceof ProductVariantDraftBuilder ? $this->masterVariant->build() : $this->masterVariant;
263 }
264
272 public function getVariants()
273 {
274 return $this->variants;
275 }
276
283 public function getTaxCategory()
284 {
285 return $this->taxCategory instanceof TaxCategoryResourceIdentifierBuilder ? $this->taxCategory->build() : $this->taxCategory;
286 }
287
294 public function getSearchKeywords()
295 {
296 return $this->searchKeywords instanceof SearchKeywordsBuilder ? $this->searchKeywords->build() : $this->searchKeywords;
297 }
298
305 public function getState()
306 {
307 return $this->state instanceof StateResourceIdentifierBuilder ? $this->state->build() : $this->state;
308 }
309
318 public function getPublish()
319 {
320 return $this->publish;
321 }
322
329 public function getPriceMode()
330 {
331 return $this->priceMode;
332 }
333
341 public function getAttributes()
342 {
343 return $this->attributes;
344 }
345
350 public function withProductType(?ProductTypeResourceIdentifier $productType)
351 {
352 $this->productType = $productType;
353
354 return $this;
355 }
356
361 public function withName(?LocalizedString $name)
362 {
363 $this->name = $name;
364
365 return $this;
366 }
367
372 public function withSlug(?LocalizedString $slug)
373 {
374 $this->slug = $slug;
375
376 return $this;
377 }
378
383 public function withKey(?string $key)
384 {
385 $this->key = $key;
386
387 return $this;
388 }
389
394 public function withDescription(?LocalizedString $description)
395 {
396 $this->description = $description;
397
398 return $this;
399 }
400
406 {
407 $this->categories = $categories;
408
409 return $this;
410 }
411
416 public function withCategoryOrderHints(?CategoryOrderHints $categoryOrderHints)
417 {
418 $this->categoryOrderHints = $categoryOrderHints;
419
420 return $this;
421 }
422
427 public function withMetaTitle(?LocalizedString $metaTitle)
428 {
429 $this->metaTitle = $metaTitle;
430
431 return $this;
432 }
433
438 public function withMetaDescription(?LocalizedString $metaDescription)
439 {
440 $this->metaDescription = $metaDescription;
441
442 return $this;
443 }
444
449 public function withMetaKeywords(?LocalizedString $metaKeywords)
450 {
451 $this->metaKeywords = $metaKeywords;
452
453 return $this;
454 }
455
460 public function withMasterVariant(?ProductVariantDraft $masterVariant)
461 {
462 $this->masterVariant = $masterVariant;
463
464 return $this;
465 }
466
471 public function withVariants(?ProductVariantDraftCollection $variants)
472 {
473 $this->variants = $variants;
474
475 return $this;
476 }
477
482 public function withTaxCategory(?TaxCategoryResourceIdentifier $taxCategory)
483 {
484 $this->taxCategory = $taxCategory;
485
486 return $this;
487 }
488
493 public function withSearchKeywords(?SearchKeywords $searchKeywords)
494 {
495 $this->searchKeywords = $searchKeywords;
496
497 return $this;
498 }
499
504 public function withState(?StateResourceIdentifier $state)
505 {
506 $this->state = $state;
507
508 return $this;
509 }
510
515 public function withPublish(?bool $publish)
516 {
517 $this->publish = $publish;
518
519 return $this;
520 }
521
526 public function withPriceMode(?string $priceMode)
527 {
528 $this->priceMode = $priceMode;
529
530 return $this;
531 }
532
537 public function withAttributes(?AttributeCollection $attributes)
538 {
539 $this->attributes = $attributes;
540
541 return $this;
542 }
543
549 {
550 $this->productType = $productType;
551
552 return $this;
553 }
554
560 {
561 $this->name = $name;
562
563 return $this;
564 }
565
571 {
572 $this->slug = $slug;
573
574 return $this;
575 }
576
581 public function withDescriptionBuilder(?LocalizedStringBuilder $description)
582 {
583 $this->description = $description;
584
585 return $this;
586 }
587
592 public function withCategoryOrderHintsBuilder(?CategoryOrderHintsBuilder $categoryOrderHints)
593 {
594 $this->categoryOrderHints = $categoryOrderHints;
595
596 return $this;
597 }
598
603 public function withMetaTitleBuilder(?LocalizedStringBuilder $metaTitle)
604 {
605 $this->metaTitle = $metaTitle;
606
607 return $this;
608 }
609
614 public function withMetaDescriptionBuilder(?LocalizedStringBuilder $metaDescription)
615 {
616 $this->metaDescription = $metaDescription;
617
618 return $this;
619 }
620
625 public function withMetaKeywordsBuilder(?LocalizedStringBuilder $metaKeywords)
626 {
627 $this->metaKeywords = $metaKeywords;
628
629 return $this;
630 }
631
637 {
638 $this->masterVariant = $masterVariant;
639
640 return $this;
641 }
642
648 {
649 $this->taxCategory = $taxCategory;
650
651 return $this;
652 }
653
658 public function withSearchKeywordsBuilder(?SearchKeywordsBuilder $searchKeywords)
659 {
660 $this->searchKeywords = $searchKeywords;
661
662 return $this;
663 }
664
670 {
671 $this->state = $state;
672
673 return $this;
674 }
675
676 public function build(): ProductDraft
677 {
678 return new ProductDraftModel(
679 $this->productType instanceof ProductTypeResourceIdentifierBuilder ? $this->productType->build() : $this->productType,
680 $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name,
681 $this->slug instanceof LocalizedStringBuilder ? $this->slug->build() : $this->slug,
682 $this->key,
683 $this->description instanceof LocalizedStringBuilder ? $this->description->build() : $this->description,
684 $this->categories,
685 $this->categoryOrderHints instanceof CategoryOrderHintsBuilder ? $this->categoryOrderHints->build() : $this->categoryOrderHints,
686 $this->metaTitle instanceof LocalizedStringBuilder ? $this->metaTitle->build() : $this->metaTitle,
687 $this->metaDescription instanceof LocalizedStringBuilder ? $this->metaDescription->build() : $this->metaDescription,
688 $this->metaKeywords instanceof LocalizedStringBuilder ? $this->metaKeywords->build() : $this->metaKeywords,
689 $this->masterVariant instanceof ProductVariantDraftBuilder ? $this->masterVariant->build() : $this->masterVariant,
690 $this->variants,
691 $this->taxCategory instanceof TaxCategoryResourceIdentifierBuilder ? $this->taxCategory->build() : $this->taxCategory,
692 $this->searchKeywords instanceof SearchKeywordsBuilder ? $this->searchKeywords->build() : $this->searchKeywords,
693 $this->state instanceof StateResourceIdentifierBuilder ? $this->state->build() : $this->state,
694 $this->publish,
695 $this->priceMode,
696 $this->attributes
697 );
698 }
699
700 public static function of(): ProductDraftBuilder
701 {
702 return new self();
703 }
704}
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)