commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
TaxRateDraftModel.php
1<?php
2
3declare(strict_types=1);
10
15use stdClass;
16
20final class TaxRateDraftModel extends JsonObjectModel implements TaxRateDraft
21{
26 protected $name;
27
32 protected $amount;
33
39
44 protected $country;
45
50 protected $state;
51
56 protected $subRates;
57
62 protected $key;
63
69
70
74 public function __construct(
75 ?string $name = null,
76 ?float $amount = null,
77 ?bool $includedInPrice = null,
78 ?string $country = null,
79 ?string $state = null,
81 ?string $key = null,
82 ?string $taxRoundingTarget = null
83 ) {
84 $this->name = $name;
85 $this->amount = $amount;
86 $this->includedInPrice = $includedInPrice;
87 $this->country = $country;
88 $this->state = $state;
89 $this->subRates = $subRates;
90 $this->key = $key;
91 $this->taxRoundingTarget = $taxRoundingTarget;
92 }
93
100 public function getName()
101 {
102 if (is_null($this->name)) {
104 $data = $this->raw(self::FIELD_NAME);
105 if (is_null($data)) {
106 return null;
107 }
108 $this->name = (string) $data;
109 }
110
111 return $this->name;
112 }
113
121 public function getAmount()
122 {
123 if (is_null($this->amount)) {
125 $data = $this->raw(self::FIELD_AMOUNT);
126 if (is_null($data)) {
127 return null;
128 }
129 $this->amount = (float) $data;
130 }
131
132 return $this->amount;
133 }
134
141 public function getIncludedInPrice()
142 {
143 if (is_null($this->includedInPrice)) {
145 $data = $this->raw(self::FIELD_INCLUDED_IN_PRICE);
146 if (is_null($data)) {
147 return null;
148 }
149 $this->includedInPrice = (bool) $data;
150 }
151
153 }
154
162 public function getCountry()
163 {
164 if (is_null($this->country)) {
166 $data = $this->raw(self::FIELD_COUNTRY);
167 if (is_null($data)) {
168 return null;
169 }
170 $this->country = (string) $data;
171 }
172
173 return $this->country;
174 }
175
185 public function getState()
186 {
187 if (is_null($this->state)) {
189 $data = $this->raw(self::FIELD_STATE);
190 if (is_null($data)) {
191 return null;
192 }
193 $this->state = (string) $data;
194 }
195
196 return $this->state;
197 }
198
206 public function getSubRates()
207 {
208 if (is_null($this->subRates)) {
210 $data = $this->raw(self::FIELD_SUB_RATES);
211 if (is_null($data)) {
212 return null;
213 }
214 $this->subRates = SubRateCollection::fromArray($data);
215 }
216
217 return $this->subRates;
218 }
219
227 public function getKey()
228 {
229 if (is_null($this->key)) {
231 $data = $this->raw(self::FIELD_KEY);
232 if (is_null($data)) {
233 return null;
234 }
235 $this->key = (string) $data;
236 }
237
238 return $this->key;
239 }
240
247 public function getTaxRoundingTarget()
248 {
249 if (is_null($this->taxRoundingTarget)) {
251 $data = $this->raw(self::FIELD_TAX_ROUNDING_TARGET);
252 if (is_null($data)) {
253 return null;
254 }
255 $this->taxRoundingTarget = (string) $data;
256 }
257
259 }
260
261
265 public function setName(?string $name): void
266 {
267 $this->name = $name;
268 }
269
273 public function setAmount(?float $amount): void
274 {
275 $this->amount = $amount;
276 }
277
281 public function setIncludedInPrice(?bool $includedInPrice): void
282 {
283 $this->includedInPrice = $includedInPrice;
284 }
285
289 public function setCountry(?string $country): void
290 {
291 $this->country = $country;
292 }
293
297 public function setState(?string $state): void
298 {
299 $this->state = $state;
300 }
301
306 {
307 $this->subRates = $subRates;
308 }
309
313 public function setKey(?string $key): void
314 {
315 $this->key = $key;
316 }
317
321 public function setTaxRoundingTarget(?string $taxRoundingTarget): void
322 {
323 $this->taxRoundingTarget = $taxRoundingTarget;
324 }
325}
__construct(?string $name=null, ?float $amount=null, ?bool $includedInPrice=null, ?string $country=null, ?string $state=null, ?SubRateCollection $subRates=null, ?string $key=null, ?string $taxRoundingTarget=null)
static fromArray(array $data)