commercetools-sdk-php-v2  master
The platform, import-api and ml-api PHP sdks generated from our api reference.
LineItemImportDraftModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
25 use stdClass;
26 
31 {
36  protected $product;
37 
42  protected $name;
43 
48  protected $variant;
49 
54  protected $price;
55 
60  protected $quantity;
61 
66  protected $state;
67 
72  protected $supplyChannel;
73 
79 
84  protected $taxRate;
85 
90  protected $shippingDetails;
91 
96  protected $custom;
97 
98 
102  public function __construct(
104  ?LocalizedString $name = null,
106  ?LineItemPrice $price = null,
107  ?int $quantity = null,
108  ?ItemStateCollection $state = null,
111  ?TaxRate $taxRate = null,
113  ?Custom $custom = null
114  ) {
115  $this->product = $product;
116  $this->name = $name;
117  $this->variant = $variant;
118  $this->price = $price;
119  $this->quantity = $quantity;
120  $this->state = $state;
121  $this->supplyChannel = $supplyChannel;
122  $this->distributionChannel = $distributionChannel;
123  $this->taxRate = $taxRate;
124  $this->shippingDetails = $shippingDetails;
125  $this->custom = $custom;
126  }
127 
134  public function getProduct()
135  {
136  if (is_null($this->product)) {
138  $data = $this->raw(self::FIELD_PRODUCT);
139  if (is_null($data)) {
140  return null;
141  }
142 
143  $this->product = ProductKeyReferenceModel::of($data);
144  }
145 
146  return $this->product;
147  }
148 
155  public function getName()
156  {
157  if (is_null($this->name)) {
159  $data = $this->raw(self::FIELD_NAME);
160  if (is_null($data)) {
161  return null;
162  }
163 
164  $this->name = LocalizedStringModel::of($data);
165  }
166 
167  return $this->name;
168  }
169 
176  public function getVariant()
177  {
178  if (is_null($this->variant)) {
180  $data = $this->raw(self::FIELD_VARIANT);
181  if (is_null($data)) {
182  return null;
183  }
184 
185  $this->variant = LineItemProductVariantImportDraftModel::of($data);
186  }
187 
188  return $this->variant;
189  }
190 
197  public function getPrice()
198  {
199  if (is_null($this->price)) {
201  $data = $this->raw(self::FIELD_PRICE);
202  if (is_null($data)) {
203  return null;
204  }
205 
206  $this->price = LineItemPriceModel::of($data);
207  }
208 
209  return $this->price;
210  }
211 
218  public function getQuantity()
219  {
220  if (is_null($this->quantity)) {
222  $data = $this->raw(self::FIELD_QUANTITY);
223  if (is_null($data)) {
224  return null;
225  }
226  $this->quantity = (int) $data;
227  }
228 
229  return $this->quantity;
230  }
231 
236  public function getState()
237  {
238  if (is_null($this->state)) {
240  $data = $this->raw(self::FIELD_STATE);
241  if (is_null($data)) {
242  return null;
243  }
244  $this->state = ItemStateCollection::fromArray($data);
245  }
246 
247  return $this->state;
248  }
249 
258  public function getSupplyChannel()
259  {
260  if (is_null($this->supplyChannel)) {
262  $data = $this->raw(self::FIELD_SUPPLY_CHANNEL);
263  if (is_null($data)) {
264  return null;
265  }
266 
267  $this->supplyChannel = ChannelKeyReferenceModel::of($data);
268  }
269 
270  return $this->supplyChannel;
271  }
272 
281  public function getDistributionChannel()
282  {
283  if (is_null($this->distributionChannel)) {
285  $data = $this->raw(self::FIELD_DISTRIBUTION_CHANNEL);
286  if (is_null($data)) {
287  return null;
288  }
289 
290  $this->distributionChannel = ChannelKeyReferenceModel::of($data);
291  }
292 
294  }
295 
302  public function getTaxRate()
303  {
304  if (is_null($this->taxRate)) {
306  $data = $this->raw(self::FIELD_TAX_RATE);
307  if (is_null($data)) {
308  return null;
309  }
310 
311  $this->taxRate = TaxRateModel::of($data);
312  }
313 
314  return $this->taxRate;
315  }
316 
323  public function getShippingDetails()
324  {
325  if (is_null($this->shippingDetails)) {
327  $data = $this->raw(self::FIELD_SHIPPING_DETAILS);
328  if (is_null($data)) {
329  return null;
330  }
331 
332  $this->shippingDetails = ItemShippingDetailsDraftModel::of($data);
333  }
334 
335  return $this->shippingDetails;
336  }
337 
344  public function getCustom()
345  {
346  if (is_null($this->custom)) {
348  $data = $this->raw(self::FIELD_CUSTOM);
349  if (is_null($data)) {
350  return null;
351  }
352 
353  $this->custom = CustomModel::of($data);
354  }
355 
356  return $this->custom;
357  }
358 
359 
363  public function setProduct(?ProductKeyReference $product): void
364  {
365  $this->product = $product;
366  }
367 
371  public function setName(?LocalizedString $name): void
372  {
373  $this->name = $name;
374  }
375 
380  {
381  $this->variant = $variant;
382  }
383 
387  public function setPrice(?LineItemPrice $price): void
388  {
389  $this->price = $price;
390  }
391 
395  public function setQuantity(?int $quantity): void
396  {
397  $this->quantity = $quantity;
398  }
399 
403  public function setState(?ItemStateCollection $state): void
404  {
405  $this->state = $state;
406  }
407 
412  {
413  $this->supplyChannel = $supplyChannel;
414  }
415 
420  {
421  $this->distributionChannel = $distributionChannel;
422  }
423 
427  public function setTaxRate(?TaxRate $taxRate): void
428  {
429  $this->taxRate = $taxRate;
430  }
431 
436  {
437  $this->shippingDetails = $shippingDetails;
438  }
439 
443  public function setCustom(?Custom $custom): void
444  {
445  $this->custom = $custom;
446  }
447 }
static of($data=null)
Definition: MapperMap.php:45
setShippingDetails(?ItemShippingDetailsDraft $shippingDetails)
setDistributionChannel(?ChannelKeyReference $distributionChannel)
__construct(?ProductKeyReference $product=null, ?LocalizedString $name=null, ?LineItemProductVariantImportDraft $variant=null, ?LineItemPrice $price=null, ?int $quantity=null, ?ItemStateCollection $state=null, ?ChannelKeyReference $supplyChannel=null, ?ChannelKeyReference $distributionChannel=null, ?TaxRate $taxRate=null, ?ItemShippingDetailsDraft $shippingDetails=null, ?Custom $custom=null)