commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
SetLineItemPriceChangeModel.php
1<?php
2
3declare(strict_types=1);
10
15use stdClass;
20
25{
26
27 public const DISCRIMINATOR_VALUE = 'SetLineItemPriceChange';
32 protected $type;
33
38 protected $change;
39
44 protected $previousValue;
45
50 protected $nextValue;
51
56 protected $lineItem;
57
62 protected $lineItemId;
63
64
68 public function __construct(
69 ?string $change = null,
70 ?Price $previousValue = null,
71 ?Price $nextValue = null,
73 ?string $lineItemId = null,
74 ?string $type = null
75 ) {
76 $this->change = $change;
77 $this->previousValue = $previousValue;
78 $this->nextValue = $nextValue;
79 $this->lineItem = $lineItem;
80 $this->lineItemId = $lineItemId;
81 $this->type = $type ?? self::DISCRIMINATOR_VALUE;
82 }
83
88 public function getType()
89 {
90 if (is_null($this->type)) {
92 $data = $this->raw(self::FIELD_TYPE);
93 if (is_null($data)) {
94 return null;
95 }
96 $this->type = (string) $data;
97 }
98
99 return $this->type;
100 }
101
106 public function getChange()
107 {
108 if (is_null($this->change)) {
110 $data = $this->raw(self::FIELD_CHANGE);
111 if (is_null($data)) {
112 return null;
113 }
114 $this->change = (string) $data;
115 }
116
117 return $this->change;
118 }
119
126 public function getPreviousValue()
127 {
128 if (is_null($this->previousValue)) {
130 $data = $this->raw(self::FIELD_PREVIOUS_VALUE);
131 if (is_null($data)) {
132 return null;
133 }
134
135 $this->previousValue = PriceModel::of($data);
136 }
137
139 }
140
147 public function getNextValue()
148 {
149 if (is_null($this->nextValue)) {
151 $data = $this->raw(self::FIELD_NEXT_VALUE);
152 if (is_null($data)) {
153 return null;
154 }
155
156 $this->nextValue = PriceModel::of($data);
157 }
158
159 return $this->nextValue;
160 }
161
168 public function getLineItem()
169 {
170 if (is_null($this->lineItem)) {
172 $data = $this->raw(self::FIELD_LINE_ITEM);
173 if (is_null($data)) {
174 return null;
175 }
176
177 $this->lineItem = LocalizedStringModel::of($data);
178 }
179
180 return $this->lineItem;
181 }
182
189 public function getLineItemId()
190 {
191 if (is_null($this->lineItemId)) {
193 $data = $this->raw(self::FIELD_LINE_ITEM_ID);
194 if (is_null($data)) {
195 return null;
196 }
197 $this->lineItemId = (string) $data;
198 }
199
200 return $this->lineItemId;
201 }
202
203
207 public function setChange(?string $change): void
208 {
209 $this->change = $change;
210 }
211
215 public function setPreviousValue(?Price $previousValue): void
216 {
217 $this->previousValue = $previousValue;
218 }
219
223 public function setNextValue(?Price $nextValue): void
224 {
225 $this->nextValue = $nextValue;
226 }
227
231 public function setLineItem(?LocalizedString $lineItem): void
232 {
233 $this->lineItem = $lineItem;
234 }
235
239 public function setLineItemId(?string $lineItemId): void
240 {
241 $this->lineItemId = $lineItemId;
242 }
243
244
245
246}
__construct(?string $change=null, ?Price $previousValue=null, ?Price $nextValue=null, ?LocalizedString $lineItem=null, ?string $lineItemId=null, ?string $type=null)