commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
OrderAddDeliveryActionBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
20 use stdClass;
21 
25 final class OrderAddDeliveryActionBuilder implements Builder
26 {
31  private $deliveryKey;
32 
37  private $shippingKey;
38 
43  private $items;
44 
49  private $address;
50 
55  private $parcels;
56 
61  private $custom;
62 
69  public function getDeliveryKey()
70  {
71  return $this->deliveryKey;
72  }
73 
80  public function getShippingKey()
81  {
82  return $this->shippingKey;
83  }
84 
91  public function getItems()
92  {
93  return $this->items;
94  }
95 
102  public function getAddress()
103  {
104  return $this->address instanceof BaseAddressBuilder ? $this->address->build() : $this->address;
105  }
106 
114  public function getParcels()
115  {
116  return $this->parcels;
117  }
118 
125  public function getCustom()
126  {
127  return $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom;
128  }
129 
134  public function withDeliveryKey(?string $deliveryKey)
135  {
136  $this->deliveryKey = $deliveryKey;
137 
138  return $this;
139  }
140 
145  public function withShippingKey(?string $shippingKey)
146  {
147  $this->shippingKey = $shippingKey;
148 
149  return $this;
150  }
151 
156  public function withItems(?DeliveryItemCollection $items)
157  {
158  $this->items = $items;
159 
160  return $this;
161  }
162 
167  public function withAddress(?BaseAddress $address)
168  {
169  $this->address = $address;
170 
171  return $this;
172  }
173 
178  public function withParcels(?ParcelDraftCollection $parcels)
179  {
180  $this->parcels = $parcels;
181 
182  return $this;
183  }
184 
189  public function withCustom(?CustomFieldsDraft $custom)
190  {
191  $this->custom = $custom;
192 
193  return $this;
194  }
195 
200  public function withAddressBuilder(?BaseAddressBuilder $address)
201  {
202  $this->address = $address;
203 
204  return $this;
205  }
206 
211  public function withCustomBuilder(?CustomFieldsDraftBuilder $custom)
212  {
213  $this->custom = $custom;
214 
215  return $this;
216  }
217 
218  public function build(): OrderAddDeliveryAction
219  {
220  return new OrderAddDeliveryActionModel(
221  $this->deliveryKey,
222  $this->shippingKey,
223  $this->items,
224  $this->address instanceof BaseAddressBuilder ? $this->address->build() : $this->address,
225  $this->parcels,
226  $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom
227  );
228  }
229 
230  public static function of(): OrderAddDeliveryActionBuilder
231  {
232  return new self();
233  }
234 }