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
115
119 public function __construct(
120 ?int $version = null,
121 ?string $key = null,
122 ?string $name = null,
123 ?array $countries = null,
124 ?array $currencies = null,
125 ?array $languages = null,
126 ?DateTimeImmutable $createdAt = null,
127 ?string $trialUntil = null,
135 ) {
136 $this->version = $version;
137 $this->key = $key;
138 $this->name = $name;
139 $this->countries = $countries;
140 $this->currencies = $currencies;
141 $this->languages = $languages;
142 $this->createdAt = $createdAt;
143 $this->trialUntil = $trialUntil;
144 $this->messages = $messages;
145 $this->carts = $carts;
146 $this->shoppingLists = $shoppingLists;
147 $this->shippingRateInputType = $shippingRateInputType;
148 $this->externalOAuth = $externalOAuth;
149 $this->searchIndexing = $searchIndexing;
150 $this->businessUnits = $businessUnits;
151 }
152
159 public function getVersion()
160 {
161 if (is_null($this->version)) {
163 $data = $this->raw(self::FIELD_VERSION);
164 if (is_null($data)) {
165 return null;
166 }
167 $this->version = (int) $data;
168 }
169
170 return $this->version;
171 }
172
179 public function getKey()
180 {
181 if (is_null($this->key)) {
183 $data = $this->raw(self::FIELD_KEY);
184 if (is_null($data)) {
185 return null;
186 }
187 $this->key = (string) $data;
188 }
189
190 return $this->key;
191 }
192
199 public function getName()
200 {
201 if (is_null($this->name)) {
203 $data = $this->raw(self::FIELD_NAME);
204 if (is_null($data)) {
205 return null;
206 }
207 $this->name = (string) $data;
208 }
209
210 return $this->name;
211 }
212
219 public function getCountries()
220 {
221 if (is_null($this->countries)) {
223 $data = $this->raw(self::FIELD_COUNTRIES);
224 if (is_null($data)) {
225 return null;
226 }
227 $this->countries = $data;
228 }
229
230 return $this->countries;
231 }
232
239 public function getCurrencies()
240 {
241 if (is_null($this->currencies)) {
243 $data = $this->raw(self::FIELD_CURRENCIES);
244 if (is_null($data)) {
245 return null;
246 }
247 $this->currencies = $data;
248 }
249
250 return $this->currencies;
251 }
252
259 public function getLanguages()
260 {
261 if (is_null($this->languages)) {
263 $data = $this->raw(self::FIELD_LANGUAGES);
264 if (is_null($data)) {
265 return null;
266 }
267 $this->languages = $data;
268 }
269
270 return $this->languages;
271 }
272
279 public function getCreatedAt()
280 {
281 if (is_null($this->createdAt)) {
283 $data = $this->raw(self::FIELD_CREATED_AT);
284 if (is_null($data)) {
285 return null;
286 }
287 $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data);
288 if (false === $data) {
289 return null;
290 }
291 $this->createdAt = $data;
292 }
293
294 return $this->createdAt;
295 }
296
303 public function getTrialUntil()
304 {
305 if (is_null($this->trialUntil)) {
307 $data = $this->raw(self::FIELD_TRIAL_UNTIL);
308 if (is_null($data)) {
309 return null;
310 }
311 $this->trialUntil = (string) $data;
312 }
313
314 return $this->trialUntil;
315 }
316
323 public function getMessages()
324 {
325 if (is_null($this->messages)) {
327 $data = $this->raw(self::FIELD_MESSAGES);
328 if (is_null($data)) {
329 return null;
330 }
331
332 $this->messages = MessagesConfigurationModel::of($data);
333 }
334
335 return $this->messages;
336 }
337
344 public function getCarts()
345 {
346 if (is_null($this->carts)) {
348 $data = $this->raw(self::FIELD_CARTS);
349 if (is_null($data)) {
350 return null;
351 }
352
353 $this->carts = CartsConfigurationModel::of($data);
354 }
355
356 return $this->carts;
357 }
358
365 public function getShoppingLists()
366 {
367 if (is_null($this->shoppingLists)) {
369 $data = $this->raw(self::FIELD_SHOPPING_LISTS);
370 if (is_null($data)) {
371 return null;
372 }
373
374 $this->shoppingLists = ShoppingListsConfigurationModel::of($data);
375 }
376
378 }
379
386 public function getShippingRateInputType()
387 {
388 if (is_null($this->shippingRateInputType)) {
390 $data = $this->raw(self::FIELD_SHIPPING_RATE_INPUT_TYPE);
391 if (is_null($data)) {
392 return null;
393 }
395 $this->shippingRateInputType = $className::of($data);
396 }
397
399 }
400
407 public function getExternalOAuth()
408 {
409 if (is_null($this->externalOAuth)) {
411 $data = $this->raw(self::FIELD_EXTERNAL_O_AUTH);
412 if (is_null($data)) {
413 return null;
414 }
415
416 $this->externalOAuth = ExternalOAuthModel::of($data);
417 }
418
420 }
421
428 public function getSearchIndexing()
429 {
430 if (is_null($this->searchIndexing)) {
432 $data = $this->raw(self::FIELD_SEARCH_INDEXING);
433 if (is_null($data)) {
434 return null;
435 }
436
437 $this->searchIndexing = SearchIndexingConfigurationModel::of($data);
438 }
439
441 }
442
449 public function getBusinessUnits()
450 {
451 if (is_null($this->businessUnits)) {
453 $data = $this->raw(self::FIELD_BUSINESS_UNITS);
454 if (is_null($data)) {
455 return null;
456 }
457
458 $this->businessUnits = BusinessUnitConfigurationModel::of($data);
459 }
460
462 }
463
464
468 public function setVersion(?int $version): void
469 {
470 $this->version = $version;
471 }
472
476 public function setKey(?string $key): void
477 {
478 $this->key = $key;
479 }
480
484 public function setName(?string $name): void
485 {
486 $this->name = $name;
487 }
488
492 public function setCountries(?array $countries): void
493 {
494 $this->countries = $countries;
495 }
496
500 public function setCurrencies(?array $currencies): void
501 {
502 $this->currencies = $currencies;
503 }
504
508 public function setLanguages(?array $languages): void
509 {
510 $this->languages = $languages;
511 }
512
516 public function setCreatedAt(?DateTimeImmutable $createdAt): void
517 {
518 $this->createdAt = $createdAt;
519 }
520
524 public function setTrialUntil(?string $trialUntil): void
525 {
526 $this->trialUntil = $trialUntil;
527 }
528
533 {
534 $this->messages = $messages;
535 }
536
540 public function setCarts(?CartsConfiguration $carts): void
541 {
542 $this->carts = $carts;
543 }
544
549 {
550 $this->shoppingLists = $shoppingLists;
551 }
552
557 {
558 $this->shippingRateInputType = $shippingRateInputType;
559 }
560
565 {
566 $this->externalOAuth = $externalOAuth;
567 }
568
573 {
574 $this->searchIndexing = $searchIndexing;
575 }
576
581 {
582 $this->businessUnits = $businessUnits;
583 }
584
585
586 #[\ReturnTypeWillChange]
587 public function jsonSerialize()
588 {
589 $data = $this->toArray();
590 if (isset($data[Project::FIELD_CREATED_AT]) && $data[Project::FIELD_CREATED_AT] instanceof \DateTimeImmutable) {
591 $data[Project::FIELD_CREATED_AT] = $data[Project::FIELD_CREATED_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c');
592 }
593 return (object) $data;
594 }
595}
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)
setSearchIndexing(?SearchIndexingConfiguration $searchIndexing)
setCreatedAt(?DateTimeImmutable $createdAt)
setShoppingLists(?ShoppingListsConfiguration $shoppingLists)
setBusinessUnits(?BusinessUnitConfiguration $businessUnits)