commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
ShippingInfoModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
26 use stdClass;
27 
31 final class ShippingInfoModel extends JsonObjectModel implements ShippingInfo
32 {
38 
43  protected $price;
44 
49  protected $shippingRate;
50 
55  protected $taxedPrice;
56 
61  protected $taxRate;
62 
67  protected $taxCategory;
68 
73  protected $shippingMethod;
74 
79  protected $deliveries;
80 
85  protected $discountedPrice;
86 
92 
93 
97  public function __construct(
98  ?string $shippingMethodName = null,
99  ?CentPrecisionMoney $price = null,
100  ?ShippingRate $shippingRate = null,
101  ?TaxedItemPrice $taxedPrice = null,
102  ?TaxRate $taxRate = null,
107  ?string $shippingMethodState = null
108  ) {
109  $this->shippingMethodName = $shippingMethodName;
110  $this->price = $price;
111  $this->shippingRate = $shippingRate;
112  $this->taxedPrice = $taxedPrice;
113  $this->taxRate = $taxRate;
114  $this->taxCategory = $taxCategory;
115  $this->shippingMethod = $shippingMethod;
116  $this->deliveries = $deliveries;
117  $this->discountedPrice = $discountedPrice;
118  $this->shippingMethodState = $shippingMethodState;
119  }
120 
127  public function getShippingMethodName()
128  {
129  if (is_null($this->shippingMethodName)) {
131  $data = $this->raw(self::FIELD_SHIPPING_METHOD_NAME);
132  if (is_null($data)) {
133  return null;
134  }
135  $this->shippingMethodName = (string) $data;
136  }
137 
139  }
140 
147  public function getPrice()
148  {
149  if (is_null($this->price)) {
151  $data = $this->raw(self::FIELD_PRICE);
152  if (is_null($data)) {
153  return null;
154  }
155 
156  $this->price = CentPrecisionMoneyModel::of($data);
157  }
158 
159  return $this->price;
160  }
161 
168  public function getShippingRate()
169  {
170  if (is_null($this->shippingRate)) {
172  $data = $this->raw(self::FIELD_SHIPPING_RATE);
173  if (is_null($data)) {
174  return null;
175  }
176 
177  $this->shippingRate = ShippingRateModel::of($data);
178  }
179 
180  return $this->shippingRate;
181  }
182 
189  public function getTaxedPrice()
190  {
191  if (is_null($this->taxedPrice)) {
193  $data = $this->raw(self::FIELD_TAXED_PRICE);
194  if (is_null($data)) {
195  return null;
196  }
197 
198  $this->taxedPrice = TaxedItemPriceModel::of($data);
199  }
200 
201  return $this->taxedPrice;
202  }
203 
211  public function getTaxRate()
212  {
213  if (is_null($this->taxRate)) {
215  $data = $this->raw(self::FIELD_TAX_RATE);
216  if (is_null($data)) {
217  return null;
218  }
219 
220  $this->taxRate = TaxRateModel::of($data);
221  }
222 
223  return $this->taxRate;
224  }
225 
232  public function getTaxCategory()
233  {
234  if (is_null($this->taxCategory)) {
236  $data = $this->raw(self::FIELD_TAX_CATEGORY);
237  if (is_null($data)) {
238  return null;
239  }
240 
241  $this->taxCategory = TaxCategoryReferenceModel::of($data);
242  }
243 
244  return $this->taxCategory;
245  }
246 
253  public function getShippingMethod()
254  {
255  if (is_null($this->shippingMethod)) {
257  $data = $this->raw(self::FIELD_SHIPPING_METHOD);
258  if (is_null($data)) {
259  return null;
260  }
261 
262  $this->shippingMethod = ShippingMethodReferenceModel::of($data);
263  }
264 
265  return $this->shippingMethod;
266  }
267 
274  public function getDeliveries()
275  {
276  if (is_null($this->deliveries)) {
278  $data = $this->raw(self::FIELD_DELIVERIES);
279  if (is_null($data)) {
280  return null;
281  }
282  $this->deliveries = DeliveryCollection::fromArray($data);
283  }
284 
285  return $this->deliveries;
286  }
287 
294  public function getDiscountedPrice()
295  {
296  if (is_null($this->discountedPrice)) {
298  $data = $this->raw(self::FIELD_DISCOUNTED_PRICE);
299  if (is_null($data)) {
300  return null;
301  }
302 
303  $this->discountedPrice = DiscountedLineItemPriceModel::of($data);
304  }
305 
306  return $this->discountedPrice;
307  }
308 
315  public function getShippingMethodState()
316  {
317  if (is_null($this->shippingMethodState)) {
319  $data = $this->raw(self::FIELD_SHIPPING_METHOD_STATE);
320  if (is_null($data)) {
321  return null;
322  }
323  $this->shippingMethodState = (string) $data;
324  }
325 
327  }
328 
329 
333  public function setShippingMethodName(?string $shippingMethodName): void
334  {
335  $this->shippingMethodName = $shippingMethodName;
336  }
337 
341  public function setPrice(?CentPrecisionMoney $price): void
342  {
343  $this->price = $price;
344  }
345 
350  {
351  $this->shippingRate = $shippingRate;
352  }
353 
357  public function setTaxedPrice(?TaxedItemPrice $taxedPrice): void
358  {
359  $this->taxedPrice = $taxedPrice;
360  }
361 
365  public function setTaxRate(?TaxRate $taxRate): void
366  {
367  $this->taxRate = $taxRate;
368  }
369 
374  {
375  $this->taxCategory = $taxCategory;
376  }
377 
382  {
383  $this->shippingMethod = $shippingMethod;
384  }
385 
390  {
391  $this->deliveries = $deliveries;
392  }
393 
398  {
399  $this->discountedPrice = $discountedPrice;
400  }
401 
405  public function setShippingMethodState(?string $shippingMethodState): void
406  {
407  $this->shippingMethodState = $shippingMethodState;
408  }
409 }
setShippingMethodState(?string $shippingMethodState)
setTaxCategory(?TaxCategoryReference $taxCategory)
setDeliveries(?DeliveryCollection $deliveries)
setShippingMethod(?ShippingMethodReference $shippingMethod)
__construct(?string $shippingMethodName=null, ?CentPrecisionMoney $price=null, ?ShippingRate $shippingRate=null, ?TaxedItemPrice $taxedPrice=null, ?TaxRate $taxRate=null, ?TaxCategoryReference $taxCategory=null, ?ShippingMethodReference $shippingMethod=null, ?DeliveryCollection $deliveries=null, ?DiscountedLineItemPrice $discountedPrice=null, ?string $shippingMethodState=null)
setDiscountedPrice(?DiscountedLineItemPrice $discountedPrice)