commercetools-sdk-php-v2  master
The platform, import-api and ml-api PHP sdks generated from our api reference.
ProductVariantImportBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
22 use stdClass;
23 
27 final class ProductVariantImportBuilder implements Builder
28 {
33  private $key;
34 
39  private $sku;
40 
45  private $isMasterVariant;
46 
51  private $attributes;
52 
57  private $images;
58 
63  private $assets;
64 
69  private $publish;
70 
75  private $product;
76 
83  public function getKey()
84  {
85  return $this->key;
86  }
87 
94  public function getSku()
95  {
96  return $this->sku;
97  }
98 
105  public function getIsMasterVariant()
106  {
107  return $this->isMasterVariant;
108  }
109 
117  public function getAttributes()
118  {
119  return $this->attributes;
120  }
121 
128  public function getImages()
129  {
130  return $this->images;
131  }
132 
139  public function getAssets()
140  {
141  return $this->assets;
142  }
143 
152  public function getPublish()
153  {
154  return $this->publish;
155  }
156 
165  public function getProduct()
166  {
167  return $this->product instanceof ProductKeyReferenceBuilder ? $this->product->build() : $this->product;
168  }
169 
174  public function withKey(?string $key)
175  {
176  $this->key = $key;
177 
178  return $this;
179  }
180 
185  public function withSku(?string $sku)
186  {
187  $this->sku = $sku;
188 
189  return $this;
190  }
191 
196  public function withIsMasterVariant(?bool $isMasterVariant)
197  {
198  $this->isMasterVariant = $isMasterVariant;
199 
200  return $this;
201  }
202 
207  public function withAttributes(?AttributeCollection $attributes)
208  {
209  $this->attributes = $attributes;
210 
211  return $this;
212  }
213 
218  public function withImages(?ImageCollection $images)
219  {
220  $this->images = $images;
221 
222  return $this;
223  }
224 
229  public function withAssets(?AssetCollection $assets)
230  {
231  $this->assets = $assets;
232 
233  return $this;
234  }
235 
240  public function withPublish(?bool $publish)
241  {
242  $this->publish = $publish;
243 
244  return $this;
245  }
246 
251  public function withProduct(?ProductKeyReference $product)
252  {
253  $this->product = $product;
254 
255  return $this;
256  }
257 
263  {
264  $this->product = $product;
265 
266  return $this;
267  }
268 
269  public function build(): ProductVariantImport
270  {
271  return new ProductVariantImportModel(
272  $this->key,
273  $this->sku,
274  $this->isMasterVariant,
275  $this->attributes,
276  $this->images,
277  $this->assets,
278  $this->publish,
279  $this->product instanceof ProductKeyReferenceBuilder ? $this->product->build() : $this->product
280  );
281  }
282 
283  public static function of(): ProductVariantImportBuilder
284  {
285  return new self();
286  }
287 }