commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
ParcelItemsModel.php
1<?php
2
3declare(strict_types=1);
10
16use stdClass;
17
21final class ParcelItemsModel extends JsonObjectModel implements ParcelItems
22{
27 protected $parcelId;
28
33 protected $items;
34
35
39 public function __construct(
40 ?string $parcelId = null,
42 ) {
43 $this->parcelId = $parcelId;
44 $this->items = $items;
45 }
46
51 public function getParcelId()
52 {
53 if (is_null($this->parcelId)) {
55 $data = $this->raw(self::FIELD_PARCEL_ID);
56 if (is_null($data)) {
57 return null;
58 }
59 $this->parcelId = (string) $data;
60 }
61
62 return $this->parcelId;
63 }
64
69 public function getItems()
70 {
71 if (is_null($this->items)) {
73 $data = $this->raw(self::FIELD_ITEMS);
74 if (is_null($data)) {
75 return null;
76 }
77 $this->items = DeliveryItemCollection::fromArray($data);
78 }
79
80 return $this->items;
81 }
82
83
87 public function setParcelId(?string $parcelId): void
88 {
89 $this->parcelId = $parcelId;
90 }
91
95 public function setItems(?DeliveryItemCollection $items): void
96 {
97 $this->items = $items;
98 }
99}
__construct(?string $parcelId=null, ?DeliveryItemCollection $items=null)