commercetools-sdk-php-v2  master
The platform, import-api and ml-api PHP sdks generated from our api reference.
TaxRateModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
15 use stdClass;
16 
20 final class TaxRateModel extends JsonObjectModel implements TaxRate
21 {
26  protected $id;
27 
32  protected $name;
33 
38  protected $amount;
39 
44  protected $includedInPrice;
45 
50  protected $country;
51 
56  protected $state;
57 
62  protected $subRates;
63 
64 
68  public function __construct(
69  ?string $id = null,
70  ?string $name = null,
71  ?float $amount = null,
72  ?bool $includedInPrice = null,
73  ?string $country = null,
74  ?string $state = null,
76  ) {
77  $this->id = $id;
78  $this->name = $name;
79  $this->amount = $amount;
80  $this->includedInPrice = $includedInPrice;
81  $this->country = $country;
82  $this->state = $state;
83  $this->subRates = $subRates;
84  }
85 
90  public function getId()
91  {
92  if (is_null($this->id)) {
94  $data = $this->raw(self::FIELD_ID);
95  if (is_null($data)) {
96  return null;
97  }
98  $this->id = (string) $data;
99  }
100 
101  return $this->id;
102  }
103 
108  public function getName()
109  {
110  if (is_null($this->name)) {
112  $data = $this->raw(self::FIELD_NAME);
113  if (is_null($data)) {
114  return null;
115  }
116  $this->name = (string) $data;
117  }
118 
119  return $this->name;
120  }
121 
126  public function getAmount()
127  {
128  if (is_null($this->amount)) {
130  $data = $this->raw(self::FIELD_AMOUNT);
131  if (is_null($data)) {
132  return null;
133  }
134  $this->amount = (float) $data;
135  }
136 
137  return $this->amount;
138  }
139 
144  public function getIncludedInPrice()
145  {
146  if (is_null($this->includedInPrice)) {
148  $data = $this->raw(self::FIELD_INCLUDED_IN_PRICE);
149  if (is_null($data)) {
150  return null;
151  }
152  $this->includedInPrice = (bool) $data;
153  }
154 
155  return $this->includedInPrice;
156  }
157 
164  public function getCountry()
165  {
166  if (is_null($this->country)) {
168  $data = $this->raw(self::FIELD_COUNTRY);
169  if (is_null($data)) {
170  return null;
171  }
172  $this->country = (string) $data;
173  }
174 
175  return $this->country;
176  }
177 
182  public function getState()
183  {
184  if (is_null($this->state)) {
186  $data = $this->raw(self::FIELD_STATE);
187  if (is_null($data)) {
188  return null;
189  }
190  $this->state = (string) $data;
191  }
192 
193  return $this->state;
194  }
195 
200  public function getSubRates()
201  {
202  if (is_null($this->subRates)) {
204  $data = $this->raw(self::FIELD_SUB_RATES);
205  if (is_null($data)) {
206  return null;
207  }
208  $this->subRates = SubRateCollection::fromArray($data);
209  }
210 
211  return $this->subRates;
212  }
213 
214 
218  public function setId(?string $id): void
219  {
220  $this->id = $id;
221  }
222 
226  public function setName(?string $name): void
227  {
228  $this->name = $name;
229  }
230 
234  public function setAmount(?float $amount): void
235  {
236  $this->amount = $amount;
237  }
238 
242  public function setIncludedInPrice(?bool $includedInPrice): void
243  {
244  $this->includedInPrice = $includedInPrice;
245  }
246 
250  public function setCountry(?string $country): void
251  {
252  $this->country = $country;
253  }
254 
258  public function setState(?string $state): void
259  {
260  $this->state = $state;
261  }
262 
266  public function setSubRates(?SubRateCollection $subRates): void
267  {
268  $this->subRates = $subRates;
269  }
270 }
setSubRates(?SubRateCollection $subRates)
__construct(?string $id=null, ?string $name=null, ?float $amount=null, ?bool $includedInPrice=null, ?string $country=null, ?string $state=null, ?SubRateCollection $subRates=null)