commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
ProjectModel.php
1<?php
2
3declare(strict_types=1);
10
17use DateTimeImmutable;
18use stdClass;
19
23final class ProjectModel extends JsonObjectModel implements Project
24{
29 protected $version;
30
35 protected $key;
36
41 protected $name;
42
47 protected $countries;
48
53 protected $currencies;
54
59 protected $languages;
60
65 protected $createdAt;
66
71 protected $trialUntil;
72
77 protected $messages;
78
83 protected $carts;
84
89 protected $shoppingLists;
90
96
101 protected $externalOAuth;
102
108
113 protected $businessUnits;
114
119 protected $discounts;
120
121
125 public function __construct(
126 ?int $version = null,
127 ?string $key = null,
128 ?string $name = null,
129 ?array $countries = null,
130 ?array $currencies = null,
131 ?array $languages = null,
132 ?DateTimeImmutable $createdAt = null,
133 ?string $trialUntil = null,
142 ) {
143 $this->version = $version;
144 $this->key = $key;
145 $this->name = $name;
146 $this->countries = $countries;
147 $this->currencies = $currencies;
148 $this->languages = $languages;
149 $this->createdAt = $createdAt;
150 $this->trialUntil = $trialUntil;
151 $this->messages = $messages;
152 $this->carts = $carts;
153 $this->shoppingLists = $shoppingLists;
154 $this->shippingRateInputType = $shippingRateInputType;
155 $this->externalOAuth = $externalOAuth;
156 $this->searchIndexing = $searchIndexing;
157 $this->businessUnits = $businessUnits;
158 $this->discounts = $discounts;
159 }
160
167 public function getVersion()
168 {
169 if (is_null($this->version)) {
171 $data = $this->raw(self::FIELD_VERSION);
172 if (is_null($data)) {
173 return null;
174 }
175 $this->version = (int) $data;
176 }
177
178 return $this->version;
179 }
180
187 public function getKey()
188 {
189 if (is_null($this->key)) {
191 $data = $this->raw(self::FIELD_KEY);
192 if (is_null($data)) {
193 return null;
194 }
195 $this->key = (string) $data;
196 }
197
198 return $this->key;
199 }
200
207 public function getName()
208 {
209 if (is_null($this->name)) {
211 $data = $this->raw(self::FIELD_NAME);
212 if (is_null($data)) {
213 return null;
214 }
215 $this->name = (string) $data;
216 }
217
218 return $this->name;
219 }
220
227 public function getCountries()
228 {
229 if (is_null($this->countries)) {
231 $data = $this->raw(self::FIELD_COUNTRIES);
232 if (is_null($data)) {
233 return null;
234 }
235 $this->countries = $data;
236 }
237
238 return $this->countries;
239 }
240
247 public function getCurrencies()
248 {
249 if (is_null($this->currencies)) {
251 $data = $this->raw(self::FIELD_CURRENCIES);
252 if (is_null($data)) {
253 return null;
254 }
255 $this->currencies = $data;
256 }
257
258 return $this->currencies;
259 }
260
267 public function getLanguages()
268 {
269 if (is_null($this->languages)) {
271 $data = $this->raw(self::FIELD_LANGUAGES);
272 if (is_null($data)) {
273 return null;
274 }
275 $this->languages = $data;
276 }
277
278 return $this->languages;
279 }
280
287 public function getCreatedAt()
288 {
289 if (is_null($this->createdAt)) {
291 $data = $this->raw(self::FIELD_CREATED_AT);
292 if (is_null($data)) {
293 return null;
294 }
295 $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data);
296 if (false === $data) {
297 return null;
298 }
299 $this->createdAt = $data;
300 }
301
302 return $this->createdAt;
303 }
304
311 public function getTrialUntil()
312 {
313 if (is_null($this->trialUntil)) {
315 $data = $this->raw(self::FIELD_TRIAL_UNTIL);
316 if (is_null($data)) {
317 return null;
318 }
319 $this->trialUntil = (string) $data;
320 }
321
322 return $this->trialUntil;
323 }
324
331 public function getMessages()
332 {
333 if (is_null($this->messages)) {
335 $data = $this->raw(self::FIELD_MESSAGES);
336 if (is_null($data)) {
337 return null;
338 }
339
340 $this->messages = MessagesConfigurationModel::of($data);
341 }
342
343 return $this->messages;
344 }
345
352 public function getCarts()
353 {
354 if (is_null($this->carts)) {
356 $data = $this->raw(self::FIELD_CARTS);
357 if (is_null($data)) {
358 return null;
359 }
360
361 $this->carts = CartsConfigurationModel::of($data);
362 }
363
364 return $this->carts;
365 }
366
373 public function getShoppingLists()
374 {
375 if (is_null($this->shoppingLists)) {
377 $data = $this->raw(self::FIELD_SHOPPING_LISTS);
378 if (is_null($data)) {
379 return null;
380 }
381
382 $this->shoppingLists = ShoppingListsConfigurationModel::of($data);
383 }
384
386 }
387
394 public function getShippingRateInputType()
395 {
396 if (is_null($this->shippingRateInputType)) {
398 $data = $this->raw(self::FIELD_SHIPPING_RATE_INPUT_TYPE);
399 if (is_null($data)) {
400 return null;
401 }
403 $this->shippingRateInputType = $className::of($data);
404 }
405
407 }
408
415 public function getExternalOAuth()
416 {
417 if (is_null($this->externalOAuth)) {
419 $data = $this->raw(self::FIELD_EXTERNAL_O_AUTH);
420 if (is_null($data)) {
421 return null;
422 }
423
424 $this->externalOAuth = ExternalOAuthModel::of($data);
425 }
426
428 }
429
436 public function getSearchIndexing()
437 {
438 if (is_null($this->searchIndexing)) {
440 $data = $this->raw(self::FIELD_SEARCH_INDEXING);
441 if (is_null($data)) {
442 return null;
443 }
444
445 $this->searchIndexing = SearchIndexingConfigurationModel::of($data);
446 }
447
449 }
450
457 public function getBusinessUnits()
458 {
459 if (is_null($this->businessUnits)) {
461 $data = $this->raw(self::FIELD_BUSINESS_UNITS);
462 if (is_null($data)) {
463 return null;
464 }
465
466 $this->businessUnits = BusinessUnitConfigurationModel::of($data);
467 }
468
470 }
471
478 public function getDiscounts()
479 {
480 if (is_null($this->discounts)) {
482 $data = $this->raw(self::FIELD_DISCOUNTS);
483 if (is_null($data)) {
484 return null;
485 }
486
487 $this->discounts = DiscountsConfigurationModel::of($data);
488 }
489
490 return $this->discounts;
491 }
492
493
497 public function setVersion(?int $version): void
498 {
499 $this->version = $version;
500 }
501
505 public function setKey(?string $key): void
506 {
507 $this->key = $key;
508 }
509
513 public function setName(?string $name): void
514 {
515 $this->name = $name;
516 }
517
521 public function setCountries(?array $countries): void
522 {
523 $this->countries = $countries;
524 }
525
529 public function setCurrencies(?array $currencies): void
530 {
531 $this->currencies = $currencies;
532 }
533
537 public function setLanguages(?array $languages): void
538 {
539 $this->languages = $languages;
540 }
541
545 public function setCreatedAt(?DateTimeImmutable $createdAt): void
546 {
547 $this->createdAt = $createdAt;
548 }
549
553 public function setTrialUntil(?string $trialUntil): void
554 {
555 $this->trialUntil = $trialUntil;
556 }
557
562 {
563 $this->messages = $messages;
564 }
565
569 public function setCarts(?CartsConfiguration $carts): void
570 {
571 $this->carts = $carts;
572 }
573
578 {
579 $this->shoppingLists = $shoppingLists;
580 }
581
586 {
587 $this->shippingRateInputType = $shippingRateInputType;
588 }
589
594 {
595 $this->externalOAuth = $externalOAuth;
596 }
597
602 {
603 $this->searchIndexing = $searchIndexing;
604 }
605
610 {
611 $this->businessUnits = $businessUnits;
612 }
613
618 {
619 $this->discounts = $discounts;
620 }
621
622
623 #[\ReturnTypeWillChange]
624 public function jsonSerialize()
625 {
626 $data = $this->toArray();
627 if (isset($data[Project::FIELD_CREATED_AT]) && $data[Project::FIELD_CREATED_AT] instanceof \DateTimeImmutable) {
628 $data[Project::FIELD_CREATED_AT] = $data[Project::FIELD_CREATED_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c');
629 }
630 return (object) $data;
631 }
632}
__construct(?int $version=null, ?string $key=null, ?string $name=null, ?array $countries=null, ?array $currencies=null, ?array $languages=null, ?DateTimeImmutable $createdAt=null, ?string $trialUntil=null, ?MessagesConfiguration $messages=null, ?CartsConfiguration $carts=null, ?ShoppingListsConfiguration $shoppingLists=null, ?ShippingRateInputType $shippingRateInputType=null, ?ExternalOAuth $externalOAuth=null, ?SearchIndexingConfiguration $searchIndexing=null, ?BusinessUnitConfiguration $businessUnits=null, ?DiscountsConfiguration $discounts=null)
setShippingRateInputType(?ShippingRateInputType $shippingRateInputType)
setExternalOAuth(?ExternalOAuth $externalOAuth)
setMessages(?MessagesConfiguration $messages)
setSearchIndexing(?SearchIndexingConfiguration $searchIndexing)
setDiscounts(?DiscountsConfiguration $discounts)
setCreatedAt(?DateTimeImmutable $createdAt)
setShoppingLists(?ShoppingListsConfiguration $shoppingLists)
setBusinessUnits(?BusinessUnitConfiguration $businessUnits)