commercetools-sdk-php-v2  master
The platform, import-api and ml-api PHP sdks generated from our api reference.
DeliveryDraftBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
19 use stdClass;
20 
24 final class DeliveryDraftBuilder implements Builder
25 {
30  private $items;
31 
36  private $address;
37 
42  private $parcels;
43 
48  public function getItems()
49  {
50  return $this->items;
51  }
52 
57  public function getAddress()
58  {
59  return $this->address instanceof AddressBuilder ? $this->address->build() : $this->address;
60  }
61 
66  public function getParcels()
67  {
68  return $this->parcels;
69  }
70 
75  public function withItems(?DeliveryItemCollection $items)
76  {
77  $this->items = $items;
78 
79  return $this;
80  }
81 
86  public function withAddress(?Address $address)
87  {
88  $this->address = $address;
89 
90  return $this;
91  }
92 
97  public function withParcels(?DeliveryParcelDraftCollection $parcels)
98  {
99  $this->parcels = $parcels;
100 
101  return $this;
102  }
103 
108  public function withAddressBuilder(?AddressBuilder $address)
109  {
110  $this->address = $address;
111 
112  return $this;
113  }
114 
115  public function build(): DeliveryDraft
116  {
117  return new DeliveryDraftModel(
118  $this->items,
119  $this->address instanceof AddressBuilder ? $this->address->build() : $this->address,
120  $this->parcels
121  );
122  }
123 
124  public static function of(): DeliveryDraftBuilder
125  {
126  return new self();
127  }
128 }