commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
MyBusinessUnitDraftBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
19 use stdClass;
20 
24 final class MyBusinessUnitDraftBuilder implements Builder
25 {
30  private $key;
31 
36  private $name;
37 
42  private $contactEmail;
43 
48  private $custom;
49 
54  private $addresses;
55 
60  private $shippingAddresses;
61 
66  private $defaultShippingAddress;
67 
72  private $billingAddresses;
73 
78  private $defaultBillingAddress;
79 
86  public function getKey()
87  {
88  return $this->key;
89  }
90 
97  public function getName()
98  {
99  return $this->name;
100  }
101 
108  public function getContactEmail()
109  {
110  return $this->contactEmail;
111  }
112 
119  public function getCustom()
120  {
121  return $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom;
122  }
123 
130  public function getAddresses()
131  {
132  return $this->addresses;
133  }
134 
142  public function getShippingAddresses()
143  {
144  return $this->shippingAddresses;
145  }
146 
153  public function getDefaultShippingAddress()
154  {
155  return $this->defaultShippingAddress;
156  }
157 
165  public function getBillingAddresses()
166  {
167  return $this->billingAddresses;
168  }
169 
176  public function getDefaultBillingAddress()
177  {
178  return $this->defaultBillingAddress;
179  }
180 
185  public function withKey(?string $key)
186  {
187  $this->key = $key;
188 
189  return $this;
190  }
191 
196  public function withName(?string $name)
197  {
198  $this->name = $name;
199 
200  return $this;
201  }
202 
207  public function withContactEmail(?string $contactEmail)
208  {
209  $this->contactEmail = $contactEmail;
210 
211  return $this;
212  }
213 
218  public function withCustom(?CustomFieldsDraft $custom)
219  {
220  $this->custom = $custom;
221 
222  return $this;
223  }
224 
229  public function withAddresses(?BaseAddressCollection $addresses)
230  {
231  $this->addresses = $addresses;
232 
233  return $this;
234  }
235 
240  public function withShippingAddresses(?array $shippingAddresses)
241  {
242  $this->shippingAddresses = $shippingAddresses;
243 
244  return $this;
245  }
246 
251  public function withDefaultShippingAddress(?int $defaultShippingAddress)
252  {
253  $this->defaultShippingAddress = $defaultShippingAddress;
254 
255  return $this;
256  }
257 
262  public function withBillingAddresses(?array $billingAddresses)
263  {
264  $this->billingAddresses = $billingAddresses;
265 
266  return $this;
267  }
268 
273  public function withDefaultBillingAddress(?int $defaultBillingAddress)
274  {
275  $this->defaultBillingAddress = $defaultBillingAddress;
276 
277  return $this;
278  }
279 
284  public function withCustomBuilder(?CustomFieldsDraftBuilder $custom)
285  {
286  $this->custom = $custom;
287 
288  return $this;
289  }
290 
291  public function build(): MyBusinessUnitDraft
292  {
293  return new MyBusinessUnitDraftModel(
294  $this->key,
295  $this->name,
296  $this->contactEmail,
297  $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom,
298  $this->addresses,
299  $this->shippingAddresses,
300  $this->defaultShippingAddress,
301  $this->billingAddresses,
302  $this->defaultBillingAddress
303  );
304  }
305 
306  public static function of(): MyBusinessUnitDraftBuilder
307  {
308  return new self();
309  }
310 }