commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
ProductDataBuilder.php
1<?php
2
3declare(strict_types=1);
10
19use stdClass;
20
24final class ProductDataBuilder implements Builder
25{
30 private $name;
31
36 private $categories;
37
42 private $categoryOrderHints;
43
48 private $description;
49
54 private $slug;
55
60 private $metaTitle;
61
66 private $metaDescription;
67
72 private $metaKeywords;
73
78 private $masterVariant;
79
84 private $variants;
85
90 private $searchKeywords;
91
98 public function getName()
99 {
100 return $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name;
101 }
102
109 public function getCategories()
110 {
111 return $this->categories;
112 }
113
120 public function getCategoryOrderHints()
121 {
122 return $this->categoryOrderHints instanceof CategoryOrderHintsBuilder ? $this->categoryOrderHints->build() : $this->categoryOrderHints;
123 }
124
131 public function getDescription()
132 {
133 return $this->description instanceof LocalizedStringBuilder ? $this->description->build() : $this->description;
134 }
135
144 public function getSlug()
145 {
146 return $this->slug instanceof LocalizedStringBuilder ? $this->slug->build() : $this->slug;
147 }
148
155 public function getMetaTitle()
156 {
157 return $this->metaTitle instanceof LocalizedStringBuilder ? $this->metaTitle->build() : $this->metaTitle;
158 }
159
166 public function getMetaDescription()
167 {
168 return $this->metaDescription instanceof LocalizedStringBuilder ? $this->metaDescription->build() : $this->metaDescription;
169 }
170
177 public function getMetaKeywords()
178 {
179 return $this->metaKeywords instanceof LocalizedStringBuilder ? $this->metaKeywords->build() : $this->metaKeywords;
180 }
181
188 public function getMasterVariant()
189 {
190 return $this->masterVariant instanceof ProductVariantBuilder ? $this->masterVariant->build() : $this->masterVariant;
191 }
192
199 public function getVariants()
200 {
201 return $this->variants;
202 }
203
210 public function getSearchKeywords()
211 {
212 return $this->searchKeywords instanceof SearchKeywordsBuilder ? $this->searchKeywords->build() : $this->searchKeywords;
213 }
214
219 public function withName(?LocalizedString $name)
220 {
221 $this->name = $name;
222
223 return $this;
224 }
225
230 public function withCategories(?CategoryReferenceCollection $categories)
231 {
232 $this->categories = $categories;
233
234 return $this;
235 }
236
241 public function withCategoryOrderHints(?CategoryOrderHints $categoryOrderHints)
242 {
243 $this->categoryOrderHints = $categoryOrderHints;
244
245 return $this;
246 }
247
252 public function withDescription(?LocalizedString $description)
253 {
254 $this->description = $description;
255
256 return $this;
257 }
258
263 public function withSlug(?LocalizedString $slug)
264 {
265 $this->slug = $slug;
266
267 return $this;
268 }
269
274 public function withMetaTitle(?LocalizedString $metaTitle)
275 {
276 $this->metaTitle = $metaTitle;
277
278 return $this;
279 }
280
285 public function withMetaDescription(?LocalizedString $metaDescription)
286 {
287 $this->metaDescription = $metaDescription;
288
289 return $this;
290 }
291
296 public function withMetaKeywords(?LocalizedString $metaKeywords)
297 {
298 $this->metaKeywords = $metaKeywords;
299
300 return $this;
301 }
302
307 public function withMasterVariant(?ProductVariant $masterVariant)
308 {
309 $this->masterVariant = $masterVariant;
310
311 return $this;
312 }
313
318 public function withVariants(?ProductVariantCollection $variants)
319 {
320 $this->variants = $variants;
321
322 return $this;
323 }
324
329 public function withSearchKeywords(?SearchKeywords $searchKeywords)
330 {
331 $this->searchKeywords = $searchKeywords;
332
333 return $this;
334 }
335
341 {
342 $this->name = $name;
343
344 return $this;
345 }
346
351 public function withCategoryOrderHintsBuilder(?CategoryOrderHintsBuilder $categoryOrderHints)
352 {
353 $this->categoryOrderHints = $categoryOrderHints;
354
355 return $this;
356 }
357
362 public function withDescriptionBuilder(?LocalizedStringBuilder $description)
363 {
364 $this->description = $description;
365
366 return $this;
367 }
368
374 {
375 $this->slug = $slug;
376
377 return $this;
378 }
379
384 public function withMetaTitleBuilder(?LocalizedStringBuilder $metaTitle)
385 {
386 $this->metaTitle = $metaTitle;
387
388 return $this;
389 }
390
395 public function withMetaDescriptionBuilder(?LocalizedStringBuilder $metaDescription)
396 {
397 $this->metaDescription = $metaDescription;
398
399 return $this;
400 }
401
406 public function withMetaKeywordsBuilder(?LocalizedStringBuilder $metaKeywords)
407 {
408 $this->metaKeywords = $metaKeywords;
409
410 return $this;
411 }
412
417 public function withMasterVariantBuilder(?ProductVariantBuilder $masterVariant)
418 {
419 $this->masterVariant = $masterVariant;
420
421 return $this;
422 }
423
428 public function withSearchKeywordsBuilder(?SearchKeywordsBuilder $searchKeywords)
429 {
430 $this->searchKeywords = $searchKeywords;
431
432 return $this;
433 }
434
435 public function build(): ProductData
436 {
437 return new ProductDataModel(
438 $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name,
439 $this->categories,
440 $this->categoryOrderHints instanceof CategoryOrderHintsBuilder ? $this->categoryOrderHints->build() : $this->categoryOrderHints,
441 $this->description instanceof LocalizedStringBuilder ? $this->description->build() : $this->description,
442 $this->slug instanceof LocalizedStringBuilder ? $this->slug->build() : $this->slug,
443 $this->metaTitle instanceof LocalizedStringBuilder ? $this->metaTitle->build() : $this->metaTitle,
444 $this->metaDescription instanceof LocalizedStringBuilder ? $this->metaDescription->build() : $this->metaDescription,
445 $this->metaKeywords instanceof LocalizedStringBuilder ? $this->metaKeywords->build() : $this->metaKeywords,
446 $this->masterVariant instanceof ProductVariantBuilder ? $this->masterVariant->build() : $this->masterVariant,
447 $this->variants,
448 $this->searchKeywords instanceof SearchKeywordsBuilder ? $this->searchKeywords->build() : $this->searchKeywords
449 );
450 }
451
452 public static function of(): ProductDataBuilder
453 {
454 return new self();
455 }
456}
withCategories(?CategoryReferenceCollection $categories)
withCategoryOrderHintsBuilder(?CategoryOrderHintsBuilder $categoryOrderHints)
withMasterVariantBuilder(?ProductVariantBuilder $masterVariant)
withVariants(?ProductVariantCollection $variants)
withDescriptionBuilder(?LocalizedStringBuilder $description)
withMetaDescription(?LocalizedString $metaDescription)
withSearchKeywordsBuilder(?SearchKeywordsBuilder $searchKeywords)
withMetaTitleBuilder(?LocalizedStringBuilder $metaTitle)
withCategoryOrderHints(?CategoryOrderHints $categoryOrderHints)
withMetaDescriptionBuilder(?LocalizedStringBuilder $metaDescription)
withMetaKeywordsBuilder(?LocalizedStringBuilder $metaKeywords)