commercetools-sdk-php-v2  master
The platform, import-api and ml-api PHP sdks generated from our api reference.
DeliveryDraftModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
18 use stdClass;
19 
23 final class DeliveryDraftModel extends JsonObjectModel implements DeliveryDraft
24 {
29  protected $items;
30 
35  protected $address;
36 
41  protected $parcels;
42 
43 
47  public function __construct(
49  ?Address $address = null,
51  ) {
52  $this->items = $items;
53  $this->address = $address;
54  $this->parcels = $parcels;
55  }
56 
61  public function getItems()
62  {
63  if (is_null($this->items)) {
65  $data = $this->raw(self::FIELD_ITEMS);
66  if (is_null($data)) {
67  return null;
68  }
69  $this->items = DeliveryItemCollection::fromArray($data);
70  }
71 
72  return $this->items;
73  }
74 
79  public function getAddress()
80  {
81  if (is_null($this->address)) {
83  $data = $this->raw(self::FIELD_ADDRESS);
84  if (is_null($data)) {
85  return null;
86  }
87 
88  $this->address = AddressModel::of($data);
89  }
90 
91  return $this->address;
92  }
93 
98  public function getParcels()
99  {
100  if (is_null($this->parcels)) {
102  $data = $this->raw(self::FIELD_PARCELS);
103  if (is_null($data)) {
104  return null;
105  }
106  $this->parcels = DeliveryParcelDraftCollection::fromArray($data);
107  }
108 
109  return $this->parcels;
110  }
111 
112 
116  public function setItems(?DeliveryItemCollection $items): void
117  {
118  $this->items = $items;
119  }
120 
124  public function setAddress(?Address $address): void
125  {
126  $this->address = $address;
127  }
128 
133  {
134  $this->parcels = $parcels;
135  }
136 }
__construct(?DeliveryItemCollection $items=null, ?Address $address=null, ?DeliveryParcelDraftCollection $parcels=null)