commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
SetDiscountedPriceChangeModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
15 use stdClass;
18 
23 {
24 
25  public const DISCRIMINATOR_VALUE = 'SetDiscountedPriceChange';
30  protected $type;
31 
36  protected $change;
37 
42  protected $previousValue;
43 
48  protected $nextValue;
49 
54  protected $catalogData;
55 
60  protected $variant;
61 
66  protected $priceId;
67 
68 
72  public function __construct(
73  ?string $change = null,
74  ?Price $previousValue = null,
75  ?Price $nextValue = null,
76  ?string $catalogData = null,
77  ?string $variant = null,
78  ?string $priceId = null,
79  ?string $type = null
80  ) {
81  $this->change = $change;
82  $this->previousValue = $previousValue;
83  $this->nextValue = $nextValue;
84  $this->catalogData = $catalogData;
85  $this->variant = $variant;
86  $this->priceId = $priceId;
87  $this->type = $type ?? self::DISCRIMINATOR_VALUE;
88  }
89 
94  public function getType()
95  {
96  if (is_null($this->type)) {
98  $data = $this->raw(self::FIELD_TYPE);
99  if (is_null($data)) {
100  return null;
101  }
102  $this->type = (string) $data;
103  }
104 
105  return $this->type;
106  }
107 
112  public function getChange()
113  {
114  if (is_null($this->change)) {
116  $data = $this->raw(self::FIELD_CHANGE);
117  if (is_null($data)) {
118  return null;
119  }
120  $this->change = (string) $data;
121  }
122 
123  return $this->change;
124  }
125 
132  public function getPreviousValue()
133  {
134  if (is_null($this->previousValue)) {
136  $data = $this->raw(self::FIELD_PREVIOUS_VALUE);
137  if (is_null($data)) {
138  return null;
139  }
140 
141  $this->previousValue = PriceModel::of($data);
142  }
143 
144  return $this->previousValue;
145  }
146 
153  public function getNextValue()
154  {
155  if (is_null($this->nextValue)) {
157  $data = $this->raw(self::FIELD_NEXT_VALUE);
158  if (is_null($data)) {
159  return null;
160  }
161 
162  $this->nextValue = PriceModel::of($data);
163  }
164 
165  return $this->nextValue;
166  }
167 
177  public function getCatalogData()
178  {
179  if (is_null($this->catalogData)) {
181  $data = $this->raw(self::FIELD_CATALOG_DATA);
182  if (is_null($data)) {
183  return null;
184  }
185  $this->catalogData = (string) $data;
186  }
187 
188  return $this->catalogData;
189  }
190 
197  public function getVariant()
198  {
199  if (is_null($this->variant)) {
201  $data = $this->raw(self::FIELD_VARIANT);
202  if (is_null($data)) {
203  return null;
204  }
205  $this->variant = (string) $data;
206  }
207 
208  return $this->variant;
209  }
210 
217  public function getPriceId()
218  {
219  if (is_null($this->priceId)) {
221  $data = $this->raw(self::FIELD_PRICE_ID);
222  if (is_null($data)) {
223  return null;
224  }
225  $this->priceId = (string) $data;
226  }
227 
228  return $this->priceId;
229  }
230 
231 
235  public function setChange(?string $change): void
236  {
237  $this->change = $change;
238  }
239 
243  public function setPreviousValue(?Price $previousValue): void
244  {
245  $this->previousValue = $previousValue;
246  }
247 
251  public function setNextValue(?Price $nextValue): void
252  {
253  $this->nextValue = $nextValue;
254  }
255 
259  public function setCatalogData(?string $catalogData): void
260  {
261  $this->catalogData = $catalogData;
262  }
263 
267  public function setVariant(?string $variant): void
268  {
269  $this->variant = $variant;
270  }
271 
275  public function setPriceId(?string $priceId): void
276  {
277  $this->priceId = $priceId;
278  }
279 
280 
281 
282 }
__construct(?string $change=null, ?Price $previousValue=null, ?Price $nextValue=null, ?string $catalogData=null, ?string $variant=null, ?string $priceId=null, ?string $type=null)