commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
VariantAttributesAvailabilityModel.php
1<?php
2
3declare(strict_types=1);
10
15use stdClass;
16
21{
26 protected $isOnStock;
27
33
39
44 protected $channels;
45
46
50 public function __construct(
51 ?bool $isOnStock = null,
52 ?int $restockableInDays = null,
53 ?int $availableQuantity = null,
55 ) {
56 $this->isOnStock = $isOnStock;
57 $this->restockableInDays = $restockableInDays;
58 $this->availableQuantity = $availableQuantity;
59 $this->channels = $channels;
60 }
61
68 public function getIsOnStock()
69 {
70 if (is_null($this->isOnStock)) {
72 $data = $this->raw(self::FIELD_IS_ON_STOCK);
73 if (is_null($data)) {
74 return null;
75 }
76 $this->isOnStock = (bool) $data;
77 }
78
79 return $this->isOnStock;
80 }
81
88 public function getRestockableInDays()
89 {
90 if (is_null($this->restockableInDays)) {
92 $data = $this->raw(self::FIELD_RESTOCKABLE_IN_DAYS);
93 if (is_null($data)) {
94 return null;
95 }
96 $this->restockableInDays = (int) $data;
97 }
98
100 }
101
108 public function getAvailableQuantity()
109 {
110 if (is_null($this->availableQuantity)) {
112 $data = $this->raw(self::FIELD_AVAILABLE_QUANTITY);
113 if (is_null($data)) {
114 return null;
115 }
116 $this->availableQuantity = (int) $data;
117 }
118
120 }
121
129 public function getChannels()
130 {
131 if (is_null($this->channels)) {
133 $data = $this->raw(self::FIELD_CHANNELS);
134 if (is_null($data)) {
135 return null;
136 }
137
139 }
140
141 return $this->channels;
142 }
143
144
148 public function setIsOnStock(?bool $isOnStock): void
149 {
150 $this->isOnStock = $isOnStock;
151 }
152
156 public function setRestockableInDays(?int $restockableInDays): void
157 {
158 $this->restockableInDays = $restockableInDays;
159 }
160
164 public function setAvailableQuantity(?int $availableQuantity): void
165 {
166 $this->availableQuantity = $availableQuantity;
167 }
168
173 {
174 $this->channels = $channels;
175 }
176}
__construct(?bool $isOnStock=null, ?int $restockableInDays=null, ?int $availableQuantity=null, ?VariantAttributesChannelAvailabilityMap $channels=null)
static of($data=null)