commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
TaxPortionDraftModel.php
1<?php
2
3declare(strict_types=1);
10
17use stdClass;
18
23{
28 protected $name;
29
34 protected $rate;
35
40 protected $amount;
41
42
46 public function __construct(
47 ?string $name = null,
48 ?float $rate = null,
49 ?Money $amount = null
50 ) {
51 $this->name = $name;
52 $this->rate = $rate;
53 $this->amount = $amount;
54 }
55
62 public function getName()
63 {
64 if (is_null($this->name)) {
66 $data = $this->raw(self::FIELD_NAME);
67 if (is_null($data)) {
68 return null;
69 }
70 $this->name = (string) $data;
71 }
72
73 return $this->name;
74 }
75
82 public function getRate()
83 {
84 if (is_null($this->rate)) {
86 $data = $this->raw(self::FIELD_RATE);
87 if (is_null($data)) {
88 return null;
89 }
90 $this->rate = (float) $data;
91 }
92
93 return $this->rate;
94 }
95
102 public function getAmount()
103 {
104 if (is_null($this->amount)) {
106 $data = $this->raw(self::FIELD_AMOUNT);
107 if (is_null($data)) {
108 return null;
109 }
110
111 $this->amount = MoneyModel::of($data);
112 }
113
114 return $this->amount;
115 }
116
117
121 public function setName(?string $name): void
122 {
123 $this->name = $name;
124 }
125
129 public function setRate(?float $rate): void
130 {
131 $this->rate = $rate;
132 }
133
137 public function setAmount(?Money $amount): void
138 {
139 $this->amount = $amount;
140 }
141}
__construct(?string $name=null, ?float $rate=null, ?Money $amount=null)