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
183 public function getKey()
184 {
185 return $this->key;
186 }
187
194 public function getDescription()
195 {
196 return $this->description instanceof LocalizedStringBuilder ? $this->description->build() : $this->description;
197 }
198
205 public function getCategories()
206 {
207 return $this->categories;
208 }
209
216 public function getCategoryOrderHints()
217 {
218 return $this->categoryOrderHints instanceof CategoryOrderHintsBuilder ? $this->categoryOrderHints->build() : $this->categoryOrderHints;
219 }
220
227 public function getMetaTitle()
228 {
229 return $this->metaTitle instanceof LocalizedStringBuilder ? $this->metaTitle->build() : $this->metaTitle;
230 }
231
238 public function getMetaDescription()
239 {
240 return $this->metaDescription instanceof LocalizedStringBuilder ? $this->metaDescription->build() : $this->metaDescription;
241 }
242
249 public function getMetaKeywords()
250 {
251 return $this->metaKeywords instanceof LocalizedStringBuilder ? $this->metaKeywords->build() : $this->metaKeywords;
252 }
253
260 public function getMasterVariant()
261 {
262 return $this->masterVariant instanceof ProductVariantDraftBuilder ? $this->masterVariant->build() : $this->masterVariant;
263 }
264
271 public function getVariants()
272 {
273 return $this->variants;
274 }
275
282 public function getTaxCategory()
283 {
284 return $this->taxCategory instanceof TaxCategoryResourceIdentifierBuilder ? $this->taxCategory->build() : $this->taxCategory;
285 }
286
293 public function getSearchKeywords()
294 {
295 return $this->searchKeywords instanceof SearchKeywordsBuilder ? $this->searchKeywords->build() : $this->searchKeywords;
296 }
297
304 public function getState()
305 {
306 return $this->state instanceof StateResourceIdentifierBuilder ? $this->state->build() : $this->state;
307 }
308
315 public function getPublish()
316 {
317 return $this->publish;
318 }
319
326 public function getPriceMode()
327 {
328 return $this->priceMode;
329 }
330
338 public function getAttributes()
339 {
340 return $this->attributes;
341 }
342
347 public function withProductType(?ProductTypeResourceIdentifier $productType)
348 {
349 $this->productType = $productType;
350
351 return $this;
352 }
353
358 public function withName(?LocalizedString $name)
359 {
360 $this->name = $name;
361
362 return $this;
363 }
364
369 public function withSlug(?LocalizedString $slug)
370 {
371 $this->slug = $slug;
372
373 return $this;
374 }
375
380 public function withKey(?string $key)
381 {
382 $this->key = $key;
383
384 return $this;
385 }
386
391 public function withDescription(?LocalizedString $description)
392 {
393 $this->description = $description;
394
395 return $this;
396 }
397
403 {
404 $this->categories = $categories;
405
406 return $this;
407 }
408
413 public function withCategoryOrderHints(?CategoryOrderHints $categoryOrderHints)
414 {
415 $this->categoryOrderHints = $categoryOrderHints;
416
417 return $this;
418 }
419
424 public function withMetaTitle(?LocalizedString $metaTitle)
425 {
426 $this->metaTitle = $metaTitle;
427
428 return $this;
429 }
430
435 public function withMetaDescription(?LocalizedString $metaDescription)
436 {
437 $this->metaDescription = $metaDescription;
438
439 return $this;
440 }
441
446 public function withMetaKeywords(?LocalizedString $metaKeywords)
447 {
448 $this->metaKeywords = $metaKeywords;
449
450 return $this;
451 }
452
457 public function withMasterVariant(?ProductVariantDraft $masterVariant)
458 {
459 $this->masterVariant = $masterVariant;
460
461 return $this;
462 }
463
468 public function withVariants(?ProductVariantDraftCollection $variants)
469 {
470 $this->variants = $variants;
471
472 return $this;
473 }
474
479 public function withTaxCategory(?TaxCategoryResourceIdentifier $taxCategory)
480 {
481 $this->taxCategory = $taxCategory;
482
483 return $this;
484 }
485
490 public function withSearchKeywords(?SearchKeywords $searchKeywords)
491 {
492 $this->searchKeywords = $searchKeywords;
493
494 return $this;
495 }
496
501 public function withState(?StateResourceIdentifier $state)
502 {
503 $this->state = $state;
504
505 return $this;
506 }
507
512 public function withPublish(?bool $publish)
513 {
514 $this->publish = $publish;
515
516 return $this;
517 }
518
523 public function withPriceMode(?string $priceMode)
524 {
525 $this->priceMode = $priceMode;
526
527 return $this;
528 }
529
534 public function withAttributes(?AttributeCollection $attributes)
535 {
536 $this->attributes = $attributes;
537
538 return $this;
539 }
540
546 {
547 $this->productType = $productType;
548
549 return $this;
550 }
551
557 {
558 $this->name = $name;
559
560 return $this;
561 }
562
568 {
569 $this->slug = $slug;
570
571 return $this;
572 }
573
578 public function withDescriptionBuilder(?LocalizedStringBuilder $description)
579 {
580 $this->description = $description;
581
582 return $this;
583 }
584
589 public function withCategoryOrderHintsBuilder(?CategoryOrderHintsBuilder $categoryOrderHints)
590 {
591 $this->categoryOrderHints = $categoryOrderHints;
592
593 return $this;
594 }
595
600 public function withMetaTitleBuilder(?LocalizedStringBuilder $metaTitle)
601 {
602 $this->metaTitle = $metaTitle;
603
604 return $this;
605 }
606
611 public function withMetaDescriptionBuilder(?LocalizedStringBuilder $metaDescription)
612 {
613 $this->metaDescription = $metaDescription;
614
615 return $this;
616 }
617
622 public function withMetaKeywordsBuilder(?LocalizedStringBuilder $metaKeywords)
623 {
624 $this->metaKeywords = $metaKeywords;
625
626 return $this;
627 }
628
634 {
635 $this->masterVariant = $masterVariant;
636
637 return $this;
638 }
639
645 {
646 $this->taxCategory = $taxCategory;
647
648 return $this;
649 }
650
655 public function withSearchKeywordsBuilder(?SearchKeywordsBuilder $searchKeywords)
656 {
657 $this->searchKeywords = $searchKeywords;
658
659 return $this;
660 }
661
667 {
668 $this->state = $state;
669
670 return $this;
671 }
672
673 public function build(): ProductDraft
674 {
675 return new ProductDraftModel(
676 $this->productType instanceof ProductTypeResourceIdentifierBuilder ? $this->productType->build() : $this->productType,
677 $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name,
678 $this->slug instanceof LocalizedStringBuilder ? $this->slug->build() : $this->slug,
679 $this->key,
680 $this->description instanceof LocalizedStringBuilder ? $this->description->build() : $this->description,
681 $this->categories,
682 $this->categoryOrderHints instanceof CategoryOrderHintsBuilder ? $this->categoryOrderHints->build() : $this->categoryOrderHints,
683 $this->metaTitle instanceof LocalizedStringBuilder ? $this->metaTitle->build() : $this->metaTitle,
684 $this->metaDescription instanceof LocalizedStringBuilder ? $this->metaDescription->build() : $this->metaDescription,
685 $this->metaKeywords instanceof LocalizedStringBuilder ? $this->metaKeywords->build() : $this->metaKeywords,
686 $this->masterVariant instanceof ProductVariantDraftBuilder ? $this->masterVariant->build() : $this->masterVariant,
687 $this->variants,
688 $this->taxCategory instanceof TaxCategoryResourceIdentifierBuilder ? $this->taxCategory->build() : $this->taxCategory,
689 $this->searchKeywords instanceof SearchKeywordsBuilder ? $this->searchKeywords->build() : $this->searchKeywords,
690 $this->state instanceof StateResourceIdentifierBuilder ? $this->state->build() : $this->state,
691 $this->publish,
692 $this->priceMode,
693 $this->attributes
694 );
695 }
696
697 public static function of(): ProductDraftBuilder
698 {
699 return new self();
700 }
701}
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)