commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
VariantImportBuilder.php
1<?php
2
3declare(strict_types=1);
10
23use stdClass;
24
28final class VariantImportBuilder implements Builder
29{
34 private $key;
35
40 private $sku;
41
46 private $product;
47
52 private $publish;
53
58 private $images;
59
64 private $attributes;
65
70 private $assets;
71
78 public function getKey()
79 {
80 return $this->key;
81 }
82
89 public function getSku()
90 {
91 return $this->sku;
92 }
93
100 public function getProduct()
101 {
102 return $this->product instanceof ProductKeyReferenceBuilder ? $this->product->build() : $this->product;
103 }
104
112 public function getPublish()
113 {
114 return $this->publish;
115 }
116
123 public function getImages()
124 {
125 return $this->images;
126 }
127
134 public function getAttributes()
135 {
136 return $this->attributes;
137 }
138
145 public function getAssets()
146 {
147 return $this->assets;
148 }
149
154 public function withKey(?string $key)
155 {
156 $this->key = $key;
157
158 return $this;
159 }
160
165 public function withSku(?string $sku)
166 {
167 $this->sku = $sku;
168
169 return $this;
170 }
171
176 public function withProduct(?ProductKeyReference $product)
177 {
178 $this->product = $product;
179
180 return $this;
181 }
182
187 public function withPublish(?bool $publish)
188 {
189 $this->publish = $publish;
190
191 return $this;
192 }
193
198 public function withImages(?ImageCollection $images)
199 {
200 $this->images = $images;
201
202 return $this;
203 }
204
209 public function withAttributes(?AttributeCollection $attributes)
210 {
211 $this->attributes = $attributes;
212
213 return $this;
214 }
215
220 public function withAssets(?AssetCollection $assets)
221 {
222 $this->assets = $assets;
223
224 return $this;
225 }
226
232 {
233 $this->product = $product;
234
235 return $this;
236 }
237
238 public function build(): VariantImport
239 {
240 return new VariantImportModel(
241 $this->key,
242 $this->sku,
243 $this->product instanceof ProductKeyReferenceBuilder ? $this->product->build() : $this->product,
244 $this->publish,
245 $this->images,
246 $this->attributes,
247 $this->assets
248 );
249 }
250
251 public static function of(): VariantImportBuilder
252 {
253 return new self();
254 }
255}