commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
MyDivisionDraftBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
21 use stdClass;
22 
26 final class MyDivisionDraftBuilder implements Builder
27 {
32  private $key;
33 
38  private $name;
39 
44  private $contactEmail;
45 
50  private $custom;
51 
56  private $addresses;
57 
62  private $shippingAddresses;
63 
68  private $defaultShippingAddress;
69 
74  private $billingAddresses;
75 
80  private $defaultBillingAddress;
81 
86  private $parentUnit;
87 
94  public function getKey()
95  {
96  return $this->key;
97  }
98 
105  public function getName()
106  {
107  return $this->name;
108  }
109 
116  public function getContactEmail()
117  {
118  return $this->contactEmail;
119  }
120 
127  public function getCustom()
128  {
129  return $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom;
130  }
131 
138  public function getAddresses()
139  {
140  return $this->addresses;
141  }
142 
150  public function getShippingAddresses()
151  {
152  return $this->shippingAddresses;
153  }
154 
161  public function getDefaultShippingAddress()
162  {
163  return $this->defaultShippingAddress;
164  }
165 
173  public function getBillingAddresses()
174  {
175  return $this->billingAddresses;
176  }
177 
184  public function getDefaultBillingAddress()
185  {
186  return $this->defaultBillingAddress;
187  }
188 
195  public function getParentUnit()
196  {
197  return $this->parentUnit instanceof BusinessUnitResourceIdentifierBuilder ? $this->parentUnit->build() : $this->parentUnit;
198  }
199 
204  public function withKey(?string $key)
205  {
206  $this->key = $key;
207 
208  return $this;
209  }
210 
215  public function withName(?string $name)
216  {
217  $this->name = $name;
218 
219  return $this;
220  }
221 
226  public function withContactEmail(?string $contactEmail)
227  {
228  $this->contactEmail = $contactEmail;
229 
230  return $this;
231  }
232 
237  public function withCustom(?CustomFieldsDraft $custom)
238  {
239  $this->custom = $custom;
240 
241  return $this;
242  }
243 
248  public function withAddresses(?BaseAddressCollection $addresses)
249  {
250  $this->addresses = $addresses;
251 
252  return $this;
253  }
254 
259  public function withShippingAddresses(?array $shippingAddresses)
260  {
261  $this->shippingAddresses = $shippingAddresses;
262 
263  return $this;
264  }
265 
270  public function withDefaultShippingAddress(?int $defaultShippingAddress)
271  {
272  $this->defaultShippingAddress = $defaultShippingAddress;
273 
274  return $this;
275  }
276 
281  public function withBillingAddresses(?array $billingAddresses)
282  {
283  $this->billingAddresses = $billingAddresses;
284 
285  return $this;
286  }
287 
292  public function withDefaultBillingAddress(?int $defaultBillingAddress)
293  {
294  $this->defaultBillingAddress = $defaultBillingAddress;
295 
296  return $this;
297  }
298 
303  public function withParentUnit(?BusinessUnitResourceIdentifier $parentUnit)
304  {
305  $this->parentUnit = $parentUnit;
306 
307  return $this;
308  }
309 
314  public function withCustomBuilder(?CustomFieldsDraftBuilder $custom)
315  {
316  $this->custom = $custom;
317 
318  return $this;
319  }
320 
326  {
327  $this->parentUnit = $parentUnit;
328 
329  return $this;
330  }
331 
332  public function build(): MyDivisionDraft
333  {
334  return new MyDivisionDraftModel(
335  $this->key,
336  $this->name,
337  $this->contactEmail,
338  $this->custom instanceof CustomFieldsDraftBuilder ? $this->custom->build() : $this->custom,
339  $this->addresses,
340  $this->shippingAddresses,
341  $this->defaultShippingAddress,
342  $this->billingAddresses,
343  $this->defaultBillingAddress,
344  $this->parentUnit instanceof BusinessUnitResourceIdentifierBuilder ? $this->parentUnit->build() : $this->parentUnit
345  );
346  }
347 
348  public static function of(): MyDivisionDraftBuilder
349  {
350  return new self();
351  }
352 }
withParentUnit(?BusinessUnitResourceIdentifier $parentUnit)
withParentUnitBuilder(?BusinessUnitResourceIdentifierBuilder $parentUnit)