commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
MyCompanyDraftModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
18 use stdClass;
19 
23 final class MyCompanyDraftModel extends JsonObjectModel implements MyCompanyDraft
24 {
25  public const DISCRIMINATOR_VALUE = 'Company';
30  protected $key;
31 
36  protected $unitType;
37 
42  protected $name;
43 
48  protected $contactEmail;
49 
54  protected $custom;
55 
60  protected $addresses;
61 
66  protected $shippingAddresses;
67 
73 
78  protected $billingAddresses;
79 
85 
86 
90  public function __construct(
91  ?string $key = null,
92  ?string $name = null,
93  ?string $contactEmail = null,
94  ?CustomFieldsDraft $custom = null,
96  ?array $shippingAddresses = null,
97  ?int $defaultShippingAddress = null,
98  ?array $billingAddresses = null,
99  ?int $defaultBillingAddress = null,
100  ?string $unitType = null
101  ) {
102  $this->key = $key;
103  $this->name = $name;
104  $this->contactEmail = $contactEmail;
105  $this->custom = $custom;
106  $this->addresses = $addresses;
107  $this->shippingAddresses = $shippingAddresses;
108  $this->defaultShippingAddress = $defaultShippingAddress;
109  $this->billingAddresses = $billingAddresses;
110  $this->defaultBillingAddress = $defaultBillingAddress;
111  $this->unitType = $unitType ?? self::DISCRIMINATOR_VALUE;
112  }
113 
120  public function getKey()
121  {
122  if (is_null($this->key)) {
124  $data = $this->raw(self::FIELD_KEY);
125  if (is_null($data)) {
126  return null;
127  }
128  $this->key = (string) $data;
129  }
130 
131  return $this->key;
132  }
133 
140  public function getUnitType()
141  {
142  if (is_null($this->unitType)) {
144  $data = $this->raw(self::FIELD_UNIT_TYPE);
145  if (is_null($data)) {
146  return null;
147  }
148  $this->unitType = (string) $data;
149  }
150 
151  return $this->unitType;
152  }
153 
160  public function getName()
161  {
162  if (is_null($this->name)) {
164  $data = $this->raw(self::FIELD_NAME);
165  if (is_null($data)) {
166  return null;
167  }
168  $this->name = (string) $data;
169  }
170 
171  return $this->name;
172  }
173 
180  public function getContactEmail()
181  {
182  if (is_null($this->contactEmail)) {
184  $data = $this->raw(self::FIELD_CONTACT_EMAIL);
185  if (is_null($data)) {
186  return null;
187  }
188  $this->contactEmail = (string) $data;
189  }
190 
191  return $this->contactEmail;
192  }
193 
200  public function getCustom()
201  {
202  if (is_null($this->custom)) {
204  $data = $this->raw(self::FIELD_CUSTOM);
205  if (is_null($data)) {
206  return null;
207  }
208 
209  $this->custom = CustomFieldsDraftModel::of($data);
210  }
211 
212  return $this->custom;
213  }
214 
221  public function getAddresses()
222  {
223  if (is_null($this->addresses)) {
225  $data = $this->raw(self::FIELD_ADDRESSES);
226  if (is_null($data)) {
227  return null;
228  }
229  $this->addresses = BaseAddressCollection::fromArray($data);
230  }
231 
232  return $this->addresses;
233  }
234 
242  public function getShippingAddresses()
243  {
244  if (is_null($this->shippingAddresses)) {
246  $data = $this->raw(self::FIELD_SHIPPING_ADDRESSES);
247  if (is_null($data)) {
248  return null;
249  }
250  $this->shippingAddresses = $data;
251  }
252 
254  }
255 
262  public function getDefaultShippingAddress()
263  {
264  if (is_null($this->defaultShippingAddress)) {
266  $data = $this->raw(self::FIELD_DEFAULT_SHIPPING_ADDRESS);
267  if (is_null($data)) {
268  return null;
269  }
270  $this->defaultShippingAddress = (int) $data;
271  }
272 
274  }
275 
283  public function getBillingAddresses()
284  {
285  if (is_null($this->billingAddresses)) {
287  $data = $this->raw(self::FIELD_BILLING_ADDRESSES);
288  if (is_null($data)) {
289  return null;
290  }
291  $this->billingAddresses = $data;
292  }
293 
295  }
296 
303  public function getDefaultBillingAddress()
304  {
305  if (is_null($this->defaultBillingAddress)) {
307  $data = $this->raw(self::FIELD_DEFAULT_BILLING_ADDRESS);
308  if (is_null($data)) {
309  return null;
310  }
311  $this->defaultBillingAddress = (int) $data;
312  }
313 
315  }
316 
317 
321  public function setKey(?string $key): void
322  {
323  $this->key = $key;
324  }
325 
329  public function setName(?string $name): void
330  {
331  $this->name = $name;
332  }
333 
337  public function setContactEmail(?string $contactEmail): void
338  {
339  $this->contactEmail = $contactEmail;
340  }
341 
345  public function setCustom(?CustomFieldsDraft $custom): void
346  {
347  $this->custom = $custom;
348  }
349 
354  {
355  $this->addresses = $addresses;
356  }
357 
361  public function setShippingAddresses(?array $shippingAddresses): void
362  {
363  $this->shippingAddresses = $shippingAddresses;
364  }
365 
370  {
371  $this->defaultShippingAddress = $defaultShippingAddress;
372  }
373 
377  public function setBillingAddresses(?array $billingAddresses): void
378  {
379  $this->billingAddresses = $billingAddresses;
380  }
381 
386  {
387  $this->defaultBillingAddress = $defaultBillingAddress;
388  }
389 }
__construct(?string $key=null, ?string $name=null, ?string $contactEmail=null, ?CustomFieldsDraft $custom=null, ?BaseAddressCollection $addresses=null, ?array $shippingAddresses=null, ?int $defaultShippingAddress=null, ?array $billingAddresses=null, ?int $defaultBillingAddress=null, ?string $unitType=null)
setDefaultShippingAddress(?int $defaultShippingAddress)
setAddresses(?BaseAddressCollection $addresses)