commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
InventoryEntryBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
26 use DateTimeImmutable;
27 use stdClass;
28 
32 final class InventoryEntryBuilder implements Builder
33 {
38  private $id;
39 
44  private $version;
45 
50  private $createdAt;
51 
56  private $lastModifiedAt;
57 
62  private $lastModifiedBy;
63 
68  private $createdBy;
69 
74  private $key;
75 
80  private $sku;
81 
86  private $supplyChannel;
87 
92  private $quantityOnStock;
93 
98  private $availableQuantity;
99 
104  private $restockableInDays;
105 
110  private $expectedDelivery;
111 
116  private $custom;
117 
124  public function getId()
125  {
126  return $this->id;
127  }
128 
135  public function getVersion()
136  {
137  return $this->version;
138  }
139 
146  public function getCreatedAt()
147  {
148  return $this->createdAt;
149  }
150 
157  public function getLastModifiedAt()
158  {
159  return $this->lastModifiedAt;
160  }
161 
168  public function getLastModifiedBy()
169  {
170  return $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy;
171  }
172 
179  public function getCreatedBy()
180  {
181  return $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy;
182  }
183 
190  public function getKey()
191  {
192  return $this->key;
193  }
194 
201  public function getSku()
202  {
203  return $this->sku;
204  }
205 
212  public function getSupplyChannel()
213  {
214  return $this->supplyChannel instanceof ChannelReferenceBuilder ? $this->supplyChannel->build() : $this->supplyChannel;
215  }
216 
223  public function getQuantityOnStock()
224  {
225  return $this->quantityOnStock;
226  }
227 
234  public function getAvailableQuantity()
235  {
236  return $this->availableQuantity;
237  }
238 
245  public function getRestockableInDays()
246  {
247  return $this->restockableInDays;
248  }
249 
256  public function getExpectedDelivery()
257  {
258  return $this->expectedDelivery;
259  }
260 
267  public function getCustom()
268  {
269  return $this->custom instanceof CustomFieldsBuilder ? $this->custom->build() : $this->custom;
270  }
271 
276  public function withId(?string $id)
277  {
278  $this->id = $id;
279 
280  return $this;
281  }
282 
287  public function withVersion(?int $version)
288  {
289  $this->version = $version;
290 
291  return $this;
292  }
293 
298  public function withCreatedAt(?DateTimeImmutable $createdAt)
299  {
300  $this->createdAt = $createdAt;
301 
302  return $this;
303  }
304 
309  public function withLastModifiedAt(?DateTimeImmutable $lastModifiedAt)
310  {
311  $this->lastModifiedAt = $lastModifiedAt;
312 
313  return $this;
314  }
315 
320  public function withLastModifiedBy(?LastModifiedBy $lastModifiedBy)
321  {
322  $this->lastModifiedBy = $lastModifiedBy;
323 
324  return $this;
325  }
326 
331  public function withCreatedBy(?CreatedBy $createdBy)
332  {
333  $this->createdBy = $createdBy;
334 
335  return $this;
336  }
337 
342  public function withKey(?string $key)
343  {
344  $this->key = $key;
345 
346  return $this;
347  }
348 
353  public function withSku(?string $sku)
354  {
355  $this->sku = $sku;
356 
357  return $this;
358  }
359 
364  public function withSupplyChannel(?ChannelReference $supplyChannel)
365  {
366  $this->supplyChannel = $supplyChannel;
367 
368  return $this;
369  }
370 
375  public function withQuantityOnStock(?int $quantityOnStock)
376  {
377  $this->quantityOnStock = $quantityOnStock;
378 
379  return $this;
380  }
381 
386  public function withAvailableQuantity(?int $availableQuantity)
387  {
388  $this->availableQuantity = $availableQuantity;
389 
390  return $this;
391  }
392 
397  public function withRestockableInDays(?int $restockableInDays)
398  {
399  $this->restockableInDays = $restockableInDays;
400 
401  return $this;
402  }
403 
408  public function withExpectedDelivery(?DateTimeImmutable $expectedDelivery)
409  {
410  $this->expectedDelivery = $expectedDelivery;
411 
412  return $this;
413  }
414 
419  public function withCustom(?CustomFields $custom)
420  {
421  $this->custom = $custom;
422 
423  return $this;
424  }
425 
430  public function withLastModifiedByBuilder(?LastModifiedByBuilder $lastModifiedBy)
431  {
432  $this->lastModifiedBy = $lastModifiedBy;
433 
434  return $this;
435  }
436 
441  public function withCreatedByBuilder(?CreatedByBuilder $createdBy)
442  {
443  $this->createdBy = $createdBy;
444 
445  return $this;
446  }
447 
452  public function withSupplyChannelBuilder(?ChannelReferenceBuilder $supplyChannel)
453  {
454  $this->supplyChannel = $supplyChannel;
455 
456  return $this;
457  }
458 
463  public function withCustomBuilder(?CustomFieldsBuilder $custom)
464  {
465  $this->custom = $custom;
466 
467  return $this;
468  }
469 
470  public function build(): InventoryEntry
471  {
472  return new InventoryEntryModel(
473  $this->id,
474  $this->version,
475  $this->createdAt,
476  $this->lastModifiedAt,
477  $this->lastModifiedBy instanceof LastModifiedByBuilder ? $this->lastModifiedBy->build() : $this->lastModifiedBy,
478  $this->createdBy instanceof CreatedByBuilder ? $this->createdBy->build() : $this->createdBy,
479  $this->key,
480  $this->sku,
481  $this->supplyChannel instanceof ChannelReferenceBuilder ? $this->supplyChannel->build() : $this->supplyChannel,
482  $this->quantityOnStock,
483  $this->availableQuantity,
484  $this->restockableInDays,
485  $this->expectedDelivery,
486  $this->custom instanceof CustomFieldsBuilder ? $this->custom->build() : $this->custom
487  );
488  }
489 
490  public static function of(): InventoryEntryBuilder
491  {
492  return new self();
493  }
494 }
withId(?string $id)
getSku()
withLastModifiedAt(?DateTimeImmutable $lastModifiedAt)
withSupplyChannel(?ChannelReference $supplyChannel)
withExpectedDelivery(?DateTimeImmutable $expectedDelivery)
getId()
getRestockableInDays()
withKey(?string $key)
getVersion()
withCustom(?CustomFields $custom)
withCustomBuilder(?CustomFieldsBuilder $custom)
withCreatedAt(?DateTimeImmutable $createdAt)
withCreatedBy(?CreatedBy $createdBy)
getCreatedAt()
withRestockableInDays(?int $restockableInDays)
withSupplyChannelBuilder(?ChannelReferenceBuilder $supplyChannel)
getSupplyChannel()
getExpectedDelivery()
getQuantityOnStock()
getKey()
getCreatedBy()
getLastModifiedAt()
withVersion(?int $version)
getLastModifiedBy()
build()
withLastModifiedBy(?LastModifiedBy $lastModifiedBy)
getCustom()
withCreatedByBuilder(?CreatedByBuilder $createdBy)
static of()
withSku(?string $sku)
withLastModifiedByBuilder(?LastModifiedByBuilder $lastModifiedBy)
withQuantityOnStock(?int $quantityOnStock)
getAvailableQuantity()
withAvailableQuantity(?int $availableQuantity)