commercetools-sdk-php-v2  master
The platform, import-api and ml-api PHP sdks generated from our api reference.
CustomLineItemDraftBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
24 use stdClass;
25 
29 final class CustomLineItemDraftBuilder implements Builder
30 {
35  private $name;
36 
41  private $money;
42 
47  private $taxedPrice;
48 
53  private $totalPrice;
54 
59  private $slug;
60 
65  private $quantity;
66 
71  private $state;
72 
77  private $taxCategory;
78 
83  private $taxRate;
84 
89  private $externalTaxRate;
90 
95  private $discountedPricePerQuantity;
96 
101  private $shippingDetails;
102 
114  public function getName()
115  {
116  return $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name;
117  }
118 
123  public function getMoney()
124  {
125  return $this->money instanceof TypedMoneyBuilder ? $this->money->build() : $this->money;
126  }
127 
132  public function getTaxedPrice()
133  {
134  return $this->taxedPrice instanceof CustomLineItemTaxedPriceBuilder ? $this->taxedPrice->build() : $this->taxedPrice;
135  }
136 
141  public function getTotalPrice()
142  {
143  return $this->totalPrice instanceof TypedMoneyBuilder ? $this->totalPrice->build() : $this->totalPrice;
144  }
145 
150  public function getSlug()
151  {
152  return $this->slug;
153  }
154 
159  public function getQuantity()
160  {
161  return $this->quantity;
162  }
163 
168  public function getState()
169  {
170  return $this->state;
171  }
172 
179  public function getTaxCategory()
180  {
181  return $this->taxCategory instanceof TaxCategoryKeyReferenceBuilder ? $this->taxCategory->build() : $this->taxCategory;
182  }
183 
188  public function getTaxRate()
189  {
190  return $this->taxRate instanceof TaxRateBuilder ? $this->taxRate->build() : $this->taxRate;
191  }
192 
197  public function getExternalTaxRate()
198  {
199  return $this->externalTaxRate instanceof ExternalTaxRateDraftBuilder ? $this->externalTaxRate->build() : $this->externalTaxRate;
200  }
201 
207  {
208  return $this->discountedPricePerQuantity;
209  }
210 
215  public function getShippingDetails()
216  {
217  return $this->shippingDetails instanceof ItemShippingDetailsDraftBuilder ? $this->shippingDetails->build() : $this->shippingDetails;
218  }
219 
224  public function withName(?LocalizedString $name)
225  {
226  $this->name = $name;
227 
228  return $this;
229  }
230 
235  public function withMoney(?TypedMoney $money)
236  {
237  $this->money = $money;
238 
239  return $this;
240  }
241 
246  public function withTaxedPrice(?CustomLineItemTaxedPrice $taxedPrice)
247  {
248  $this->taxedPrice = $taxedPrice;
249 
250  return $this;
251  }
252 
257  public function withTotalPrice(?TypedMoney $totalPrice)
258  {
259  $this->totalPrice = $totalPrice;
260 
261  return $this;
262  }
263 
268  public function withSlug(?string $slug)
269  {
270  $this->slug = $slug;
271 
272  return $this;
273  }
274 
279  public function withQuantity(?int $quantity)
280  {
281  $this->quantity = $quantity;
282 
283  return $this;
284  }
285 
290  public function withState(?ItemStateCollection $state)
291  {
292  $this->state = $state;
293 
294  return $this;
295  }
296 
301  public function withTaxCategory(?TaxCategoryKeyReference $taxCategory)
302  {
303  $this->taxCategory = $taxCategory;
304 
305  return $this;
306  }
307 
312  public function withTaxRate(?TaxRate $taxRate)
313  {
314  $this->taxRate = $taxRate;
315 
316  return $this;
317  }
318 
323  public function withExternalTaxRate(?ExternalTaxRateDraft $externalTaxRate)
324  {
325  $this->externalTaxRate = $externalTaxRate;
326 
327  return $this;
328  }
329 
334  public function withDiscountedPricePerQuantity(?DiscountedLineItemPriceDraftCollection $discountedPricePerQuantity)
335  {
336  $this->discountedPricePerQuantity = $discountedPricePerQuantity;
337 
338  return $this;
339  }
340 
345  public function withShippingDetails(?ItemShippingDetailsDraft $shippingDetails)
346  {
347  $this->shippingDetails = $shippingDetails;
348 
349  return $this;
350  }
351 
356  public function withNameBuilder(?LocalizedStringBuilder $name)
357  {
358  $this->name = $name;
359 
360  return $this;
361  }
362 
367  public function withMoneyBuilder(?TypedMoneyBuilder $money)
368  {
369  $this->money = $money;
370 
371  return $this;
372  }
373 
379  {
380  $this->taxedPrice = $taxedPrice;
381 
382  return $this;
383  }
384 
389  public function withTotalPriceBuilder(?TypedMoneyBuilder $totalPrice)
390  {
391  $this->totalPrice = $totalPrice;
392 
393  return $this;
394  }
395 
401  {
402  $this->taxCategory = $taxCategory;
403 
404  return $this;
405  }
406 
411  public function withTaxRateBuilder(?TaxRateBuilder $taxRate)
412  {
413  $this->taxRate = $taxRate;
414 
415  return $this;
416  }
417 
422  public function withExternalTaxRateBuilder(?ExternalTaxRateDraftBuilder $externalTaxRate)
423  {
424  $this->externalTaxRate = $externalTaxRate;
425 
426  return $this;
427  }
428 
434  {
435  $this->shippingDetails = $shippingDetails;
436 
437  return $this;
438  }
439 
440  public function build(): CustomLineItemDraft
441  {
442  return new CustomLineItemDraftModel(
443  $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name,
444  $this->money instanceof TypedMoneyBuilder ? $this->money->build() : $this->money,
445  $this->taxedPrice instanceof CustomLineItemTaxedPriceBuilder ? $this->taxedPrice->build() : $this->taxedPrice,
446  $this->totalPrice instanceof TypedMoneyBuilder ? $this->totalPrice->build() : $this->totalPrice,
447  $this->slug,
448  $this->quantity,
449  $this->state,
450  $this->taxCategory instanceof TaxCategoryKeyReferenceBuilder ? $this->taxCategory->build() : $this->taxCategory,
451  $this->taxRate instanceof TaxRateBuilder ? $this->taxRate->build() : $this->taxRate,
452  $this->externalTaxRate instanceof ExternalTaxRateDraftBuilder ? $this->externalTaxRate->build() : $this->externalTaxRate,
453  $this->discountedPricePerQuantity,
454  $this->shippingDetails instanceof ItemShippingDetailsDraftBuilder ? $this->shippingDetails->build() : $this->shippingDetails
455  );
456  }
457 
458  public static function of(): CustomLineItemDraftBuilder
459  {
460  return new self();
461  }
462 }
withDiscountedPricePerQuantity(?DiscountedLineItemPriceDraftCollection $discountedPricePerQuantity)
withTaxedPriceBuilder(?CustomLineItemTaxedPriceBuilder $taxedPrice)
withTaxCategoryBuilder(?TaxCategoryKeyReferenceBuilder $taxCategory)
withShippingDetailsBuilder(?ItemShippingDetailsDraftBuilder $shippingDetails)
withExternalTaxRateBuilder(?ExternalTaxRateDraftBuilder $externalTaxRate)