commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
MethodTaxRateModel.php
1<?php
2
3declare(strict_types=1);
10
17use stdClass;
18
22final class MethodTaxRateModel extends JsonObjectModel implements MethodTaxRate
23{
29
34 protected $taxRate;
35
36
40 public function __construct(
41 ?string $shippingMethodKey = null,
42 ?TaxRate $taxRate = null
43 ) {
44 $this->shippingMethodKey = $shippingMethodKey;
45 $this->taxRate = $taxRate;
46 }
47
54 public function getShippingMethodKey()
55 {
56 if (is_null($this->shippingMethodKey)) {
58 $data = $this->raw(self::FIELD_SHIPPING_METHOD_KEY);
59 if (is_null($data)) {
60 return null;
61 }
62 $this->shippingMethodKey = (string) $data;
63 }
64
66 }
67
74 public function getTaxRate()
75 {
76 if (is_null($this->taxRate)) {
78 $data = $this->raw(self::FIELD_TAX_RATE);
79 if (is_null($data)) {
80 return null;
81 }
82
83 $this->taxRate = TaxRateModel::of($data);
84 }
85
86 return $this->taxRate;
87 }
88
89
93 public function setShippingMethodKey(?string $shippingMethodKey): void
94 {
95 $this->shippingMethodKey = $shippingMethodKey;
96 }
97
101 public function setTaxRate(?TaxRate $taxRate): void
102 {
103 $this->taxRate = $taxRate;
104 }
105}
__construct(?string $shippingMethodKey=null, ?TaxRate $taxRate=null)