commercetools-sdk-php-v2  master
The platform, import-api and ml-api PHP sdks generated from our api reference.
CustomLineItemDraftModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
23 use stdClass;
24 
29 {
34  protected $name;
35 
40  protected $money;
41 
46  protected $taxedPrice;
47 
52  protected $totalPrice;
53 
58  protected $slug;
59 
64  protected $quantity;
65 
70  protected $state;
71 
76  protected $taxCategory;
77 
82  protected $taxRate;
83 
88  protected $externalTaxRate;
89 
95 
100  protected $shippingDetails;
101 
102 
106  public function __construct(
107  ?LocalizedString $name = null,
108  ?TypedMoney $money = null,
110  ?TypedMoney $totalPrice = null,
111  ?string $slug = null,
112  ?int $quantity = null,
113  ?ItemStateCollection $state = null,
115  ?TaxRate $taxRate = null,
119  ) {
120  $this->name = $name;
121  $this->money = $money;
122  $this->taxedPrice = $taxedPrice;
123  $this->totalPrice = $totalPrice;
124  $this->slug = $slug;
125  $this->quantity = $quantity;
126  $this->state = $state;
127  $this->taxCategory = $taxCategory;
128  $this->taxRate = $taxRate;
129  $this->externalTaxRate = $externalTaxRate;
130  $this->discountedPricePerQuantity = $discountedPricePerQuantity;
131  $this->shippingDetails = $shippingDetails;
132  }
133 
145  public function getName()
146  {
147  if (is_null($this->name)) {
149  $data = $this->raw(self::FIELD_NAME);
150  if (is_null($data)) {
151  return null;
152  }
153 
154  $this->name = LocalizedStringModel::of($data);
155  }
156 
157  return $this->name;
158  }
159 
164  public function getMoney()
165  {
166  if (is_null($this->money)) {
168  $data = $this->raw(self::FIELD_MONEY);
169  if (is_null($data)) {
170  return null;
171  }
172  $className = TypedMoneyModel::resolveDiscriminatorClass($data);
173  $this->money = $className::of($data);
174  }
175 
176  return $this->money;
177  }
178 
183  public function getTaxedPrice()
184  {
185  if (is_null($this->taxedPrice)) {
187  $data = $this->raw(self::FIELD_TAXED_PRICE);
188  if (is_null($data)) {
189  return null;
190  }
191 
192  $this->taxedPrice = CustomLineItemTaxedPriceModel::of($data);
193  }
194 
195  return $this->taxedPrice;
196  }
197 
202  public function getTotalPrice()
203  {
204  if (is_null($this->totalPrice)) {
206  $data = $this->raw(self::FIELD_TOTAL_PRICE);
207  if (is_null($data)) {
208  return null;
209  }
210  $className = TypedMoneyModel::resolveDiscriminatorClass($data);
211  $this->totalPrice = $className::of($data);
212  }
213 
214  return $this->totalPrice;
215  }
216 
221  public function getSlug()
222  {
223  if (is_null($this->slug)) {
225  $data = $this->raw(self::FIELD_SLUG);
226  if (is_null($data)) {
227  return null;
228  }
229  $this->slug = (string) $data;
230  }
231 
232  return $this->slug;
233  }
234 
239  public function getQuantity()
240  {
241  if (is_null($this->quantity)) {
243  $data = $this->raw(self::FIELD_QUANTITY);
244  if (is_null($data)) {
245  return null;
246  }
247  $this->quantity = (int) $data;
248  }
249 
250  return $this->quantity;
251  }
252 
257  public function getState()
258  {
259  if (is_null($this->state)) {
261  $data = $this->raw(self::FIELD_STATE);
262  if (is_null($data)) {
263  return null;
264  }
265  $this->state = ItemStateCollection::fromArray($data);
266  }
267 
268  return $this->state;
269  }
270 
277  public function getTaxCategory()
278  {
279  if (is_null($this->taxCategory)) {
281  $data = $this->raw(self::FIELD_TAX_CATEGORY);
282  if (is_null($data)) {
283  return null;
284  }
285 
286  $this->taxCategory = TaxCategoryKeyReferenceModel::of($data);
287  }
288 
289  return $this->taxCategory;
290  }
291 
296  public function getTaxRate()
297  {
298  if (is_null($this->taxRate)) {
300  $data = $this->raw(self::FIELD_TAX_RATE);
301  if (is_null($data)) {
302  return null;
303  }
304 
305  $this->taxRate = TaxRateModel::of($data);
306  }
307 
308  return $this->taxRate;
309  }
310 
315  public function getExternalTaxRate()
316  {
317  if (is_null($this->externalTaxRate)) {
319  $data = $this->raw(self::FIELD_EXTERNAL_TAX_RATE);
320  if (is_null($data)) {
321  return null;
322  }
323 
324  $this->externalTaxRate = ExternalTaxRateDraftModel::of($data);
325  }
326 
327  return $this->externalTaxRate;
328  }
329 
335  {
336  if (is_null($this->discountedPricePerQuantity)) {
338  $data = $this->raw(self::FIELD_DISCOUNTED_PRICE_PER_QUANTITY);
339  if (is_null($data)) {
340  return null;
341  }
342  $this->discountedPricePerQuantity = DiscountedLineItemPriceDraftCollection::fromArray($data);
343  }
344 
346  }
347 
352  public function getShippingDetails()
353  {
354  if (is_null($this->shippingDetails)) {
356  $data = $this->raw(self::FIELD_SHIPPING_DETAILS);
357  if (is_null($data)) {
358  return null;
359  }
360 
361  $this->shippingDetails = ItemShippingDetailsDraftModel::of($data);
362  }
363 
364  return $this->shippingDetails;
365  }
366 
367 
371  public function setName(?LocalizedString $name): void
372  {
373  $this->name = $name;
374  }
375 
379  public function setMoney(?TypedMoney $money): void
380  {
381  $this->money = $money;
382  }
383 
388  {
389  $this->taxedPrice = $taxedPrice;
390  }
391 
395  public function setTotalPrice(?TypedMoney $totalPrice): void
396  {
397  $this->totalPrice = $totalPrice;
398  }
399 
403  public function setSlug(?string $slug): void
404  {
405  $this->slug = $slug;
406  }
407 
411  public function setQuantity(?int $quantity): void
412  {
413  $this->quantity = $quantity;
414  }
415 
419  public function setState(?ItemStateCollection $state): void
420  {
421  $this->state = $state;
422  }
423 
428  {
429  $this->taxCategory = $taxCategory;
430  }
431 
435  public function setTaxRate(?TaxRate $taxRate): void
436  {
437  $this->taxRate = $taxRate;
438  }
439 
444  {
445  $this->externalTaxRate = $externalTaxRate;
446  }
447 
452  {
453  $this->discountedPricePerQuantity = $discountedPricePerQuantity;
454  }
455 
460  {
461  $this->shippingDetails = $shippingDetails;
462  }
463 }
static of($data=null)
Definition: MapperMap.php:45
__construct(?LocalizedString $name=null, ?TypedMoney $money=null, ?CustomLineItemTaxedPrice $taxedPrice=null, ?TypedMoney $totalPrice=null, ?string $slug=null, ?int $quantity=null, ?ItemStateCollection $state=null, ?TaxCategoryKeyReference $taxCategory=null, ?TaxRate $taxRate=null, ?ExternalTaxRateDraft $externalTaxRate=null, ?DiscountedLineItemPriceDraftCollection $discountedPricePerQuantity=null, ?ItemShippingDetailsDraft $shippingDetails=null)
setDiscountedPricePerQuantity(?DiscountedLineItemPriceDraftCollection $discountedPricePerQuantity)
setShippingDetails(?ItemShippingDetailsDraft $shippingDetails)