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 $inventory;
120
125 protected $discounts;
126
132
133
137 public function __construct(
138 ?int $version = null,
139 ?string $key = null,
140 ?string $name = null,
141 ?array $countries = null,
142 ?array $currencies = null,
143 ?array $languages = null,
144 ?DateTimeImmutable $createdAt = null,
145 ?string $trialUntil = null,
155 ?string $productCatalogModel = null
156 ) {
157 $this->version = $version;
158 $this->key = $key;
159 $this->name = $name;
160 $this->countries = $countries;
161 $this->currencies = $currencies;
162 $this->languages = $languages;
163 $this->createdAt = $createdAt;
164 $this->trialUntil = $trialUntil;
165 $this->messages = $messages;
166 $this->carts = $carts;
167 $this->shoppingLists = $shoppingLists;
168 $this->shippingRateInputType = $shippingRateInputType;
169 $this->externalOAuth = $externalOAuth;
170 $this->searchIndexing = $searchIndexing;
171 $this->businessUnits = $businessUnits;
172 $this->inventory = $inventory;
173 $this->discounts = $discounts;
174 $this->productCatalogModel = $productCatalogModel;
175 }
176
183 public function getVersion()
184 {
185 if (is_null($this->version)) {
187 $data = $this->raw(self::FIELD_VERSION);
188 if (is_null($data)) {
189 return null;
190 }
191 $this->version = (int) $data;
192 }
193
194 return $this->version;
195 }
196
203 public function getKey()
204 {
205 if (is_null($this->key)) {
207 $data = $this->raw(self::FIELD_KEY);
208 if (is_null($data)) {
209 return null;
210 }
211 $this->key = (string) $data;
212 }
213
214 return $this->key;
215 }
216
223 public function getName()
224 {
225 if (is_null($this->name)) {
227 $data = $this->raw(self::FIELD_NAME);
228 if (is_null($data)) {
229 return null;
230 }
231 $this->name = (string) $data;
232 }
233
234 return $this->name;
235 }
236
243 public function getCountries()
244 {
245 if (is_null($this->countries)) {
247 $data = $this->raw(self::FIELD_COUNTRIES);
248 if (is_null($data)) {
249 return null;
250 }
251 $this->countries = $data;
252 }
253
254 return $this->countries;
255 }
256
263 public function getCurrencies()
264 {
265 if (is_null($this->currencies)) {
267 $data = $this->raw(self::FIELD_CURRENCIES);
268 if (is_null($data)) {
269 return null;
270 }
271 $this->currencies = $data;
272 }
273
274 return $this->currencies;
275 }
276
283 public function getLanguages()
284 {
285 if (is_null($this->languages)) {
287 $data = $this->raw(self::FIELD_LANGUAGES);
288 if (is_null($data)) {
289 return null;
290 }
291 $this->languages = $data;
292 }
293
294 return $this->languages;
295 }
296
303 public function getCreatedAt()
304 {
305 if (is_null($this->createdAt)) {
307 $data = $this->raw(self::FIELD_CREATED_AT);
308 if (is_null($data)) {
309 return null;
310 }
311 $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data);
312 if (false === $data) {
313 return null;
314 }
315 $this->createdAt = $data;
316 }
317
318 return $this->createdAt;
319 }
320
327 public function getTrialUntil()
328 {
329 if (is_null($this->trialUntil)) {
331 $data = $this->raw(self::FIELD_TRIAL_UNTIL);
332 if (is_null($data)) {
333 return null;
334 }
335 $this->trialUntil = (string) $data;
336 }
337
338 return $this->trialUntil;
339 }
340
347 public function getMessages()
348 {
349 if (is_null($this->messages)) {
351 $data = $this->raw(self::FIELD_MESSAGES);
352 if (is_null($data)) {
353 return null;
354 }
355
356 $this->messages = MessagesConfigurationModel::of($data);
357 }
358
359 return $this->messages;
360 }
361
368 public function getCarts()
369 {
370 if (is_null($this->carts)) {
372 $data = $this->raw(self::FIELD_CARTS);
373 if (is_null($data)) {
374 return null;
375 }
376
377 $this->carts = CartsConfigurationModel::of($data);
378 }
379
380 return $this->carts;
381 }
382
389 public function getShoppingLists()
390 {
391 if (is_null($this->shoppingLists)) {
393 $data = $this->raw(self::FIELD_SHOPPING_LISTS);
394 if (is_null($data)) {
395 return null;
396 }
397
398 $this->shoppingLists = ShoppingListsConfigurationModel::of($data);
399 }
400
402 }
403
410 public function getShippingRateInputType()
411 {
412 if (is_null($this->shippingRateInputType)) {
414 $data = $this->raw(self::FIELD_SHIPPING_RATE_INPUT_TYPE);
415 if (is_null($data)) {
416 return null;
417 }
419 $this->shippingRateInputType = $className::of($data);
420 }
421
423 }
424
431 public function getExternalOAuth()
432 {
433 if (is_null($this->externalOAuth)) {
435 $data = $this->raw(self::FIELD_EXTERNAL_O_AUTH);
436 if (is_null($data)) {
437 return null;
438 }
439
440 $this->externalOAuth = ExternalOAuthModel::of($data);
441 }
442
444 }
445
452 public function getSearchIndexing()
453 {
454 if (is_null($this->searchIndexing)) {
456 $data = $this->raw(self::FIELD_SEARCH_INDEXING);
457 if (is_null($data)) {
458 return null;
459 }
460
461 $this->searchIndexing = SearchIndexingConfigurationModel::of($data);
462 }
463
465 }
466
473 public function getBusinessUnits()
474 {
475 if (is_null($this->businessUnits)) {
477 $data = $this->raw(self::FIELD_BUSINESS_UNITS);
478 if (is_null($data)) {
479 return null;
480 }
481
482 $this->businessUnits = BusinessUnitConfigurationModel::of($data);
483 }
484
486 }
487
494 public function getInventory()
495 {
496 if (is_null($this->inventory)) {
498 $data = $this->raw(self::FIELD_INVENTORY);
499 if (is_null($data)) {
500 return null;
501 }
502
503 $this->inventory = InventoryConfigurationModel::of($data);
504 }
505
506 return $this->inventory;
507 }
508
515 public function getDiscounts()
516 {
517 if (is_null($this->discounts)) {
519 $data = $this->raw(self::FIELD_DISCOUNTS);
520 if (is_null($data)) {
521 return null;
522 }
523
524 $this->discounts = DiscountsConfigurationModel::of($data);
525 }
526
527 return $this->discounts;
528 }
529
537 public function getProductCatalogModel()
538 {
539 if (is_null($this->productCatalogModel)) {
541 $data = $this->raw(self::FIELD_PRODUCT_CATALOG_MODEL);
542 if (is_null($data)) {
543 return null;
544 }
545 $this->productCatalogModel = (string) $data;
546 }
547
549 }
550
551
555 public function setVersion(?int $version): void
556 {
557 $this->version = $version;
558 }
559
563 public function setKey(?string $key): void
564 {
565 $this->key = $key;
566 }
567
571 public function setName(?string $name): void
572 {
573 $this->name = $name;
574 }
575
579 public function setCountries(?array $countries): void
580 {
581 $this->countries = $countries;
582 }
583
587 public function setCurrencies(?array $currencies): void
588 {
589 $this->currencies = $currencies;
590 }
591
595 public function setLanguages(?array $languages): void
596 {
597 $this->languages = $languages;
598 }
599
603 public function setCreatedAt(?DateTimeImmutable $createdAt): void
604 {
605 $this->createdAt = $createdAt;
606 }
607
611 public function setTrialUntil(?string $trialUntil): void
612 {
613 $this->trialUntil = $trialUntil;
614 }
615
620 {
621 $this->messages = $messages;
622 }
623
627 public function setCarts(?CartsConfiguration $carts): void
628 {
629 $this->carts = $carts;
630 }
631
636 {
637 $this->shoppingLists = $shoppingLists;
638 }
639
644 {
645 $this->shippingRateInputType = $shippingRateInputType;
646 }
647
652 {
653 $this->externalOAuth = $externalOAuth;
654 }
655
660 {
661 $this->searchIndexing = $searchIndexing;
662 }
663
668 {
669 $this->businessUnits = $businessUnits;
670 }
671
676 {
677 $this->inventory = $inventory;
678 }
679
684 {
685 $this->discounts = $discounts;
686 }
687
691 public function setProductCatalogModel(?string $productCatalogModel): void
692 {
693 $this->productCatalogModel = $productCatalogModel;
694 }
695
696
697 #[\ReturnTypeWillChange]
698 public function jsonSerialize()
699 {
700 $data = $this->toArray();
701 if (isset($data[Project::FIELD_CREATED_AT]) && $data[Project::FIELD_CREATED_AT] instanceof \DateTimeImmutable) {
702 $data[Project::FIELD_CREATED_AT] = $data[Project::FIELD_CREATED_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c');
703 }
704 return (object) $data;
705 }
706}
setShippingRateInputType(?ShippingRateInputType $shippingRateInputType)
setExternalOAuth(?ExternalOAuth $externalOAuth)
setMessages(?MessagesConfiguration $messages)
__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, ?InventoryConfiguration $inventory=null, ?DiscountsConfiguration $discounts=null, ?string $productCatalogModel=null)
setSearchIndexing(?SearchIndexingConfiguration $searchIndexing)
setInventory(?InventoryConfiguration $inventory)
setDiscounts(?DiscountsConfiguration $discounts)
setCreatedAt(?DateTimeImmutable $createdAt)
setShoppingLists(?ShoppingListsConfiguration $shoppingLists)
setBusinessUnits(?BusinessUnitConfiguration $businessUnits)
setProductCatalogModel(?string $productCatalogModel)