commercetools-sdk-php-v2  master
The platform, import-api and ml-api PHP sdks generated from our api reference.
DeliveryItemModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
15 use stdClass;
16 
20 final class DeliveryItemModel extends JsonObjectModel implements DeliveryItem
21 {
26  protected $id;
27 
32  protected $quantity;
33 
34 
38  public function __construct(
39  ?string $id = null,
40  ?int $quantity = null
41  ) {
42  $this->id = $id;
43  $this->quantity = $quantity;
44  }
45 
50  public function getId()
51  {
52  if (is_null($this->id)) {
54  $data = $this->raw(self::FIELD_ID);
55  if (is_null($data)) {
56  return null;
57  }
58  $this->id = (string) $data;
59  }
60 
61  return $this->id;
62  }
63 
68  public function getQuantity()
69  {
70  if (is_null($this->quantity)) {
72  $data = $this->raw(self::FIELD_QUANTITY);
73  if (is_null($data)) {
74  return null;
75  }
76  $this->quantity = (int) $data;
77  }
78 
79  return $this->quantity;
80  }
81 
82 
86  public function setId(?string $id): void
87  {
88  $this->id = $id;
89  }
90 
94  public function setQuantity(?int $quantity): void
95  {
96  $this->quantity = $quantity;
97  }
98 }
__construct(?string $id=null, ?int $quantity=null)