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
259 public function getMasterVariant()
260 {
261 return $this->masterVariant instanceof ProductVariantDraftBuilder ? $this->masterVariant->build() : $this->masterVariant;
262 }
263
270 public function getVariants()
271 {
272 return $this->variants;
273 }
274
281 public function getTaxCategory()
282 {
283 return $this->taxCategory instanceof TaxCategoryResourceIdentifierBuilder ? $this->taxCategory->build() : $this->taxCategory;
284 }
285
292 public function getSearchKeywords()
293 {
294 return $this->searchKeywords instanceof SearchKeywordsBuilder ? $this->searchKeywords->build() : $this->searchKeywords;
295 }
296
303 public function getState()
304 {
305 return $this->state instanceof StateResourceIdentifierBuilder ? $this->state->build() : $this->state;
306 }
307
316 public function getPublish()
317 {
318 return $this->publish;
319 }
320
327 public function getPriceMode()
328 {
329 return $this->priceMode;
330 }
331
339 public function getAttributes()
340 {
341 return $this->attributes;
342 }
343
348 public function withProductType(?ProductTypeResourceIdentifier $productType)
349 {
350 $this->productType = $productType;
351
352 return $this;
353 }
354
359 public function withName(?LocalizedString $name)
360 {
361 $this->name = $name;
362
363 return $this;
364 }
365
370 public function withSlug(?LocalizedString $slug)
371 {
372 $this->slug = $slug;
373
374 return $this;
375 }
376
381 public function withKey(?string $key)
382 {
383 $this->key = $key;
384
385 return $this;
386 }
387
392 public function withDescription(?LocalizedString $description)
393 {
394 $this->description = $description;
395
396 return $this;
397 }
398
404 {
405 $this->categories = $categories;
406
407 return $this;
408 }
409
414 public function withCategoryOrderHints(?CategoryOrderHints $categoryOrderHints)
415 {
416 $this->categoryOrderHints = $categoryOrderHints;
417
418 return $this;
419 }
420
425 public function withMetaTitle(?LocalizedString $metaTitle)
426 {
427 $this->metaTitle = $metaTitle;
428
429 return $this;
430 }
431
436 public function withMetaDescription(?LocalizedString $metaDescription)
437 {
438 $this->metaDescription = $metaDescription;
439
440 return $this;
441 }
442
447 public function withMetaKeywords(?LocalizedString $metaKeywords)
448 {
449 $this->metaKeywords = $metaKeywords;
450
451 return $this;
452 }
453
458 public function withMasterVariant(?ProductVariantDraft $masterVariant)
459 {
460 $this->masterVariant = $masterVariant;
461
462 return $this;
463 }
464
469 public function withVariants(?ProductVariantDraftCollection $variants)
470 {
471 $this->variants = $variants;
472
473 return $this;
474 }
475
480 public function withTaxCategory(?TaxCategoryResourceIdentifier $taxCategory)
481 {
482 $this->taxCategory = $taxCategory;
483
484 return $this;
485 }
486
491 public function withSearchKeywords(?SearchKeywords $searchKeywords)
492 {
493 $this->searchKeywords = $searchKeywords;
494
495 return $this;
496 }
497
502 public function withState(?StateResourceIdentifier $state)
503 {
504 $this->state = $state;
505
506 return $this;
507 }
508
513 public function withPublish(?bool $publish)
514 {
515 $this->publish = $publish;
516
517 return $this;
518 }
519
524 public function withPriceMode(?string $priceMode)
525 {
526 $this->priceMode = $priceMode;
527
528 return $this;
529 }
530
535 public function withAttributes(?AttributeCollection $attributes)
536 {
537 $this->attributes = $attributes;
538
539 return $this;
540 }
541
547 {
548 $this->productType = $productType;
549
550 return $this;
551 }
552
558 {
559 $this->name = $name;
560
561 return $this;
562 }
563
569 {
570 $this->slug = $slug;
571
572 return $this;
573 }
574
579 public function withDescriptionBuilder(?LocalizedStringBuilder $description)
580 {
581 $this->description = $description;
582
583 return $this;
584 }
585
590 public function withCategoryOrderHintsBuilder(?CategoryOrderHintsBuilder $categoryOrderHints)
591 {
592 $this->categoryOrderHints = $categoryOrderHints;
593
594 return $this;
595 }
596
601 public function withMetaTitleBuilder(?LocalizedStringBuilder $metaTitle)
602 {
603 $this->metaTitle = $metaTitle;
604
605 return $this;
606 }
607
612 public function withMetaDescriptionBuilder(?LocalizedStringBuilder $metaDescription)
613 {
614 $this->metaDescription = $metaDescription;
615
616 return $this;
617 }
618
623 public function withMetaKeywordsBuilder(?LocalizedStringBuilder $metaKeywords)
624 {
625 $this->metaKeywords = $metaKeywords;
626
627 return $this;
628 }
629
635 {
636 $this->masterVariant = $masterVariant;
637
638 return $this;
639 }
640
646 {
647 $this->taxCategory = $taxCategory;
648
649 return $this;
650 }
651
656 public function withSearchKeywordsBuilder(?SearchKeywordsBuilder $searchKeywords)
657 {
658 $this->searchKeywords = $searchKeywords;
659
660 return $this;
661 }
662
668 {
669 $this->state = $state;
670
671 return $this;
672 }
673
674 public function build(): ProductDraft
675 {
676 return new ProductDraftModel(
677 $this->productType instanceof ProductTypeResourceIdentifierBuilder ? $this->productType->build() : $this->productType,
678 $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name,
679 $this->slug instanceof LocalizedStringBuilder ? $this->slug->build() : $this->slug,
680 $this->key,
681 $this->description instanceof LocalizedStringBuilder ? $this->description->build() : $this->description,
682 $this->categories,
683 $this->categoryOrderHints instanceof CategoryOrderHintsBuilder ? $this->categoryOrderHints->build() : $this->categoryOrderHints,
684 $this->metaTitle instanceof LocalizedStringBuilder ? $this->metaTitle->build() : $this->metaTitle,
685 $this->metaDescription instanceof LocalizedStringBuilder ? $this->metaDescription->build() : $this->metaDescription,
686 $this->metaKeywords instanceof LocalizedStringBuilder ? $this->metaKeywords->build() : $this->metaKeywords,
687 $this->masterVariant instanceof ProductVariantDraftBuilder ? $this->masterVariant->build() : $this->masterVariant,
688 $this->variants,
689 $this->taxCategory instanceof TaxCategoryResourceIdentifierBuilder ? $this->taxCategory->build() : $this->taxCategory,
690 $this->searchKeywords instanceof SearchKeywordsBuilder ? $this->searchKeywords->build() : $this->searchKeywords,
691 $this->state instanceof StateResourceIdentifierBuilder ? $this->state->build() : $this->state,
692 $this->publish,
693 $this->priceMode,
694 $this->attributes
695 );
696 }
697
698 public static function of(): ProductDraftBuilder
699 {
700 return new self();
701 }
702}
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)