commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
DeliveryAddressDraftBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
18 use stdClass;
19 
23 final class DeliveryAddressDraftBuilder implements Builder
24 {
29  private $deliveryId;
30 
35  private $address;
36 
41  public function getDeliveryId()
42  {
43  return $this->deliveryId;
44  }
45 
50  public function getAddress()
51  {
52  return $this->address instanceof AddressBuilder ? $this->address->build() : $this->address;
53  }
54 
59  public function withDeliveryId(?string $deliveryId)
60  {
61  $this->deliveryId = $deliveryId;
62 
63  return $this;
64  }
65 
70  public function withAddress(?Address $address)
71  {
72  $this->address = $address;
73 
74  return $this;
75  }
76 
81  public function withAddressBuilder(?AddressBuilder $address)
82  {
83  $this->address = $address;
84 
85  return $this;
86  }
87 
88  public function build(): DeliveryAddressDraft
89  {
90  return new DeliveryAddressDraftModel(
91  $this->deliveryId,
92  $this->address instanceof AddressBuilder ? $this->address->build() : $this->address
93  );
94  }
95 
96  public static function of(): DeliveryAddressDraftBuilder
97  {
98  return new self();
99  }
100 }