commercetools-sdk-php-v2  master
The platform, import-api and ml-api PHP sdks generated from our api reference.
LineItemImportDraftBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
26 use stdClass;
27 
31 final class LineItemImportDraftBuilder implements Builder
32 {
37  private $product;
38 
43  private $name;
44 
49  private $variant;
50 
55  private $price;
56 
61  private $quantity;
62 
67  private $state;
68 
73  private $supplyChannel;
74 
79  private $distributionChannel;
80 
85  private $taxRate;
86 
91  private $shippingDetails;
92 
97  private $custom;
98 
105  public function getProduct()
106  {
107  return $this->product instanceof ProductKeyReferenceBuilder ? $this->product->build() : $this->product;
108  }
109 
116  public function getName()
117  {
118  return $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name;
119  }
120 
127  public function getVariant()
128  {
129  return $this->variant instanceof LineItemProductVariantImportDraftBuilder ? $this->variant->build() : $this->variant;
130  }
131 
138  public function getPrice()
139  {
140  return $this->price instanceof LineItemPriceBuilder ? $this->price->build() : $this->price;
141  }
142 
149  public function getQuantity()
150  {
151  return $this->quantity;
152  }
153 
158  public function getState()
159  {
160  return $this->state;
161  }
162 
171  public function getSupplyChannel()
172  {
173  return $this->supplyChannel instanceof ChannelKeyReferenceBuilder ? $this->supplyChannel->build() : $this->supplyChannel;
174  }
175 
184  public function getDistributionChannel()
185  {
186  return $this->distributionChannel instanceof ChannelKeyReferenceBuilder ? $this->distributionChannel->build() : $this->distributionChannel;
187  }
188 
195  public function getTaxRate()
196  {
197  return $this->taxRate instanceof TaxRateBuilder ? $this->taxRate->build() : $this->taxRate;
198  }
199 
206  public function getShippingDetails()
207  {
208  return $this->shippingDetails instanceof ItemShippingDetailsDraftBuilder ? $this->shippingDetails->build() : $this->shippingDetails;
209  }
210 
217  public function getCustom()
218  {
219  return $this->custom instanceof CustomBuilder ? $this->custom->build() : $this->custom;
220  }
221 
226  public function withProduct(?ProductKeyReference $product)
227  {
228  $this->product = $product;
229 
230  return $this;
231  }
232 
237  public function withName(?LocalizedString $name)
238  {
239  $this->name = $name;
240 
241  return $this;
242  }
243 
249  {
250  $this->variant = $variant;
251 
252  return $this;
253  }
254 
259  public function withPrice(?LineItemPrice $price)
260  {
261  $this->price = $price;
262 
263  return $this;
264  }
265 
270  public function withQuantity(?int $quantity)
271  {
272  $this->quantity = $quantity;
273 
274  return $this;
275  }
276 
281  public function withState(?ItemStateCollection $state)
282  {
283  $this->state = $state;
284 
285  return $this;
286  }
287 
292  public function withSupplyChannel(?ChannelKeyReference $supplyChannel)
293  {
294  $this->supplyChannel = $supplyChannel;
295 
296  return $this;
297  }
298 
303  public function withDistributionChannel(?ChannelKeyReference $distributionChannel)
304  {
305  $this->distributionChannel = $distributionChannel;
306 
307  return $this;
308  }
309 
314  public function withTaxRate(?TaxRate $taxRate)
315  {
316  $this->taxRate = $taxRate;
317 
318  return $this;
319  }
320 
325  public function withShippingDetails(?ItemShippingDetailsDraft $shippingDetails)
326  {
327  $this->shippingDetails = $shippingDetails;
328 
329  return $this;
330  }
331 
336  public function withCustom(?Custom $custom)
337  {
338  $this->custom = $custom;
339 
340  return $this;
341  }
342 
348  {
349  $this->product = $product;
350 
351  return $this;
352  }
353 
358  public function withNameBuilder(?LocalizedStringBuilder $name)
359  {
360  $this->name = $name;
361 
362  return $this;
363  }
364 
370  {
371  $this->variant = $variant;
372 
373  return $this;
374  }
375 
380  public function withPriceBuilder(?LineItemPriceBuilder $price)
381  {
382  $this->price = $price;
383 
384  return $this;
385  }
386 
391  public function withSupplyChannelBuilder(?ChannelKeyReferenceBuilder $supplyChannel)
392  {
393  $this->supplyChannel = $supplyChannel;
394 
395  return $this;
396  }
397 
402  public function withDistributionChannelBuilder(?ChannelKeyReferenceBuilder $distributionChannel)
403  {
404  $this->distributionChannel = $distributionChannel;
405 
406  return $this;
407  }
408 
413  public function withTaxRateBuilder(?TaxRateBuilder $taxRate)
414  {
415  $this->taxRate = $taxRate;
416 
417  return $this;
418  }
419 
425  {
426  $this->shippingDetails = $shippingDetails;
427 
428  return $this;
429  }
430 
435  public function withCustomBuilder(?CustomBuilder $custom)
436  {
437  $this->custom = $custom;
438 
439  return $this;
440  }
441 
442  public function build(): LineItemImportDraft
443  {
444  return new LineItemImportDraftModel(
445  $this->product instanceof ProductKeyReferenceBuilder ? $this->product->build() : $this->product,
446  $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name,
447  $this->variant instanceof LineItemProductVariantImportDraftBuilder ? $this->variant->build() : $this->variant,
448  $this->price instanceof LineItemPriceBuilder ? $this->price->build() : $this->price,
449  $this->quantity,
450  $this->state,
451  $this->supplyChannel instanceof ChannelKeyReferenceBuilder ? $this->supplyChannel->build() : $this->supplyChannel,
452  $this->distributionChannel instanceof ChannelKeyReferenceBuilder ? $this->distributionChannel->build() : $this->distributionChannel,
453  $this->taxRate instanceof TaxRateBuilder ? $this->taxRate->build() : $this->taxRate,
454  $this->shippingDetails instanceof ItemShippingDetailsDraftBuilder ? $this->shippingDetails->build() : $this->shippingDetails,
455  $this->custom instanceof CustomBuilder ? $this->custom->build() : $this->custom
456  );
457  }
458 
459  public static function of(): LineItemImportDraftBuilder
460  {
461  return new self();
462  }
463 }
withDistributionChannelBuilder(?ChannelKeyReferenceBuilder $distributionChannel)
withShippingDetailsBuilder(?ItemShippingDetailsDraftBuilder $shippingDetails)
withVariantBuilder(?LineItemProductVariantImportDraftBuilder $variant)
withSupplyChannelBuilder(?ChannelKeyReferenceBuilder $supplyChannel)