commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
VariantProjectionBuilder.php
1<?php
2
3declare(strict_types=1);
10
28use DateTimeImmutable;
29use stdClass;
30
34final class VariantProjectionBuilder implements Builder
35{
40 private $id;
41
46 private $version;
47
52 private $createdAt;
53
58 private $staged;
59
64 private $variantId;
65
70 private $product;
71
76 private $name;
77
82 private $slug;
83
88 private $description;
89
94 private $categories;
95
100 private $categoryOrderHints;
101
106 private $key;
107
112 private $sku;
113
118 private $images;
119
124 private $assets;
125
130 private $attributes;
131
136 private $price;
137
142 private $default;
143
150 public function getId()
151 {
152 return $this->id;
153 }
154
161 public function getVersion()
162 {
163 return $this->version;
164 }
165
172 public function getCreatedAt()
173 {
174 return $this->createdAt;
175 }
176
183 public function getStaged()
184 {
185 return $this->staged;
186 }
187
194 public function getVariantId()
195 {
196 return $this->variantId;
197 }
198
205 public function getProduct()
206 {
207 return $this->product instanceof ProductReferenceBuilder ? $this->product->build() : $this->product;
208 }
209
216 public function getName()
217 {
218 return $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name;
219 }
220
227 public function getSlug()
228 {
229 return $this->slug instanceof LocalizedStringBuilder ? $this->slug->build() : $this->slug;
230 }
231
238 public function getDescription()
239 {
240 return $this->description instanceof LocalizedStringBuilder ? $this->description->build() : $this->description;
241 }
242
249 public function getCategories()
250 {
251 return $this->categories;
252 }
253
260 public function getCategoryOrderHints()
261 {
262 return $this->categoryOrderHints instanceof CategoryOrderHintsBuilder ? $this->categoryOrderHints->build() : $this->categoryOrderHints;
263 }
264
271 public function getKey()
272 {
273 return $this->key;
274 }
275
282 public function getSku()
283 {
284 return $this->sku;
285 }
286
293 public function getImages()
294 {
295 return $this->images;
296 }
297
304 public function getAssets()
305 {
306 return $this->assets;
307 }
308
315 public function getAttributes()
316 {
317 return $this->attributes;
318 }
319
327 public function getPrice()
328 {
329 return $this->price instanceof PriceBuilder ? $this->price->build() : $this->price;
330 }
331
338 public function getDefault()
339 {
340 return $this->default;
341 }
342
347 public function withId(?string $id)
348 {
349 $this->id = $id;
350
351 return $this;
352 }
353
358 public function withVersion(?int $version)
359 {
360 $this->version = $version;
361
362 return $this;
363 }
364
369 public function withCreatedAt(?DateTimeImmutable $createdAt)
370 {
371 $this->createdAt = $createdAt;
372
373 return $this;
374 }
375
380 public function withStaged(?bool $staged)
381 {
382 $this->staged = $staged;
383
384 return $this;
385 }
386
391 public function withVariantId(?int $variantId)
392 {
393 $this->variantId = $variantId;
394
395 return $this;
396 }
397
402 public function withProduct(?ProductReference $product)
403 {
404 $this->product = $product;
405
406 return $this;
407 }
408
413 public function withName(?LocalizedString $name)
414 {
415 $this->name = $name;
416
417 return $this;
418 }
419
424 public function withSlug(?LocalizedString $slug)
425 {
426 $this->slug = $slug;
427
428 return $this;
429 }
430
435 public function withDescription(?LocalizedString $description)
436 {
437 $this->description = $description;
438
439 return $this;
440 }
441
446 public function withCategories(?CategoryReferenceCollection $categories)
447 {
448 $this->categories = $categories;
449
450 return $this;
451 }
452
457 public function withCategoryOrderHints(?CategoryOrderHints $categoryOrderHints)
458 {
459 $this->categoryOrderHints = $categoryOrderHints;
460
461 return $this;
462 }
463
468 public function withKey(?string $key)
469 {
470 $this->key = $key;
471
472 return $this;
473 }
474
479 public function withSku(?string $sku)
480 {
481 $this->sku = $sku;
482
483 return $this;
484 }
485
490 public function withImages(?ImageCollection $images)
491 {
492 $this->images = $images;
493
494 return $this;
495 }
496
501 public function withAssets(?AssetCollection $assets)
502 {
503 $this->assets = $assets;
504
505 return $this;
506 }
507
512 public function withAttributes(?AttributeCollection $attributes)
513 {
514 $this->attributes = $attributes;
515
516 return $this;
517 }
518
523 public function withPrice(?Price $price)
524 {
525 $this->price = $price;
526
527 return $this;
528 }
529
534 public function withDefault(?bool $default)
535 {
536 $this->default = $default;
537
538 return $this;
539 }
540
546 {
547 $this->product = $product;
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 withPriceBuilder(?PriceBuilder $price)
601 {
602 $this->price = $price;
603
604 return $this;
605 }
606
607 public function build(): VariantProjection
608 {
609 return new VariantProjectionModel(
610 $this->id,
611 $this->version,
612 $this->createdAt,
613 $this->staged,
614 $this->variantId,
615 $this->product instanceof ProductReferenceBuilder ? $this->product->build() : $this->product,
616 $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name,
617 $this->slug instanceof LocalizedStringBuilder ? $this->slug->build() : $this->slug,
618 $this->description instanceof LocalizedStringBuilder ? $this->description->build() : $this->description,
619 $this->categories,
620 $this->categoryOrderHints instanceof CategoryOrderHintsBuilder ? $this->categoryOrderHints->build() : $this->categoryOrderHints,
621 $this->key,
622 $this->sku,
623 $this->images,
624 $this->assets,
625 $this->attributes,
626 $this->price instanceof PriceBuilder ? $this->price->build() : $this->price,
627 $this->default
628 );
629 }
630
631 public static function of(): VariantProjectionBuilder
632 {
633 return new self();
634 }
635}
withCategoryOrderHintsBuilder(?CategoryOrderHintsBuilder $categoryOrderHints)