commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
VariantDataBuilder.php
1<?php
2
3declare(strict_types=1);
10
19use stdClass;
20
24final class VariantDataBuilder implements Builder
25{
30 private $sku;
31
36 private $images;
37
42 private $attributes;
43
48 private $assets;
49
56 public function getSku()
57 {
58 return $this->sku;
59 }
60
67 public function getImages()
68 {
69 return $this->images;
70 }
71
78 public function getAttributes()
79 {
80 return $this->attributes;
81 }
82
89 public function getAssets()
90 {
91 return $this->assets;
92 }
93
98 public function withSku(?string $sku)
99 {
100 $this->sku = $sku;
101
102 return $this;
103 }
104
109 public function withImages(?ImageCollection $images)
110 {
111 $this->images = $images;
112
113 return $this;
114 }
115
120 public function withAttributes(?AttributeCollection $attributes)
121 {
122 $this->attributes = $attributes;
123
124 return $this;
125 }
126
131 public function withAssets(?AssetCollection $assets)
132 {
133 $this->assets = $assets;
134
135 return $this;
136 }
137
138
139 public function build(): VariantData
140 {
141 return new VariantDataModel(
142 $this->sku,
143 $this->images,
144 $this->attributes,
145 $this->assets
146 );
147 }
148
149 public static function of(): VariantDataBuilder
150 {
151 return new self();
152 }
153}