commercetools-sdk-php-v2  master
The platform, import-api and ml-api PHP sdks generated from our api reference.
ItemStateModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
17 use stdClass;
18 
22 final class ItemStateModel extends JsonObjectModel implements ItemState
23 {
28  protected $quantity;
29 
34  protected $state;
35 
36 
40  public function __construct(
41  ?int $quantity = null,
43  ) {
44  $this->quantity = $quantity;
45  $this->state = $state;
46  }
47 
52  public function getQuantity()
53  {
54  if (is_null($this->quantity)) {
56  $data = $this->raw(self::FIELD_QUANTITY);
57  if (is_null($data)) {
58  return null;
59  }
60  $this->quantity = (int) $data;
61  }
62 
63  return $this->quantity;
64  }
65 
72  public function getState()
73  {
74  if (is_null($this->state)) {
76  $data = $this->raw(self::FIELD_STATE);
77  if (is_null($data)) {
78  return null;
79  }
80 
81  $this->state = StateKeyReferenceModel::of($data);
82  }
83 
84  return $this->state;
85  }
86 
87 
91  public function setQuantity(?int $quantity): void
92  {
93  $this->quantity = $quantity;
94  }
95 
99  public function setState(?StateKeyReference $state): void
100  {
101  $this->state = $state;
102  }
103 }
__construct(?int $quantity=null, ?StateKeyReference $state=null)