commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
InventoryImportBuilder.php
1<?php
2
3declare(strict_types=1);
10
22use DateTimeImmutable;
23use stdClass;
24
28final class InventoryImportBuilder implements Builder
29{
34 private $key;
35
40 private $sku;
41
46 private $quantityOnStock;
47
52 private $restockableInDays;
53
58 private $expectedDelivery;
59
64 private $supplyChannel;
65
70 private $custom;
71
78 public function getKey()
79 {
80 return $this->key;
81 }
82
89 public function getSku()
90 {
91 return $this->sku;
92 }
93
100 public function getQuantityOnStock()
101 {
102 return $this->quantityOnStock;
103 }
104
111 public function getRestockableInDays()
112 {
113 return $this->restockableInDays;
114 }
115
122 public function getExpectedDelivery()
123 {
124 return $this->expectedDelivery;
125 }
126
133 public function getSupplyChannel()
134 {
135 return $this->supplyChannel instanceof ChannelKeyReferenceBuilder ? $this->supplyChannel->build() : $this->supplyChannel;
136 }
137
144 public function getCustom()
145 {
146 return $this->custom instanceof CustomBuilder ? $this->custom->build() : $this->custom;
147 }
148
153 public function withKey(?string $key)
154 {
155 $this->key = $key;
156
157 return $this;
158 }
159
164 public function withSku(?string $sku)
165 {
166 $this->sku = $sku;
167
168 return $this;
169 }
170
175 public function withQuantityOnStock(?int $quantityOnStock)
176 {
177 $this->quantityOnStock = $quantityOnStock;
178
179 return $this;
180 }
181
186 public function withRestockableInDays(?int $restockableInDays)
187 {
188 $this->restockableInDays = $restockableInDays;
189
190 return $this;
191 }
192
197 public function withExpectedDelivery(?DateTimeImmutable $expectedDelivery)
198 {
199 $this->expectedDelivery = $expectedDelivery;
200
201 return $this;
202 }
203
208 public function withSupplyChannel(?ChannelKeyReference $supplyChannel)
209 {
210 $this->supplyChannel = $supplyChannel;
211
212 return $this;
213 }
214
219 public function withCustom(?Custom $custom)
220 {
221 $this->custom = $custom;
222
223 return $this;
224 }
225
231 {
232 $this->supplyChannel = $supplyChannel;
233
234 return $this;
235 }
236
241 public function withCustomBuilder(?CustomBuilder $custom)
242 {
243 $this->custom = $custom;
244
245 return $this;
246 }
247
248 public function build(): InventoryImport
249 {
250 return new InventoryImportModel(
251 $this->key,
252 $this->sku,
253 $this->quantityOnStock,
254 $this->restockableInDays,
255 $this->expectedDelivery,
256 $this->supplyChannel instanceof ChannelKeyReferenceBuilder ? $this->supplyChannel->build() : $this->supplyChannel,
257 $this->custom instanceof CustomBuilder ? $this->custom->build() : $this->custom
258 );
259 }
260
261 public static function of(): InventoryImportBuilder
262 {
263 return new self();
264 }
265}
withSupplyChannelBuilder(?ChannelKeyReferenceBuilder $supplyChannel)