commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
McpServerModel.php
1<?php
2
3declare(strict_types=1);
10
23use DateTimeImmutable;
24use stdClass;
25
29final class McpServerModel extends JsonObjectModel implements McpServer
30{
35 protected $id;
36
41 protected $version;
42
47 protected $createdAt;
48
53 protected $lastModifiedAt;
54
59 protected $lastModifiedBy;
60
65 protected $createdBy;
66
71 protected $key;
72
77 protected $name;
78
83 protected $description;
84
90
95 protected $state;
96
101 protected $mcpServer;
102
103
107 public function __construct(
108 ?string $id = null,
109 ?int $version = null,
110 ?DateTimeImmutable $createdAt = null,
111 ?DateTimeImmutable $lastModifiedAt = null,
113 ?CreatedBy $createdBy = null,
114 ?string $key = null,
115 ?LocalizedString $name = null,
117 ?string $authenticationMode = null,
118 ?string $state = null,
120 ) {
121 $this->id = $id;
122 $this->version = $version;
123 $this->createdAt = $createdAt;
124 $this->lastModifiedAt = $lastModifiedAt;
125 $this->lastModifiedBy = $lastModifiedBy;
126 $this->createdBy = $createdBy;
127 $this->key = $key;
128 $this->name = $name;
129 $this->description = $description;
130 $this->authenticationMode = $authenticationMode;
131 $this->state = $state;
132 $this->mcpServer = $mcpServer;
133 }
134
141 public function getId()
142 {
143 if (is_null($this->id)) {
145 $data = $this->raw(self::FIELD_ID);
146 if (is_null($data)) {
147 return null;
148 }
149 $this->id = (string) $data;
150 }
151
152 return $this->id;
153 }
154
161 public function getVersion()
162 {
163 if (is_null($this->version)) {
165 $data = $this->raw(self::FIELD_VERSION);
166 if (is_null($data)) {
167 return null;
168 }
169 $this->version = (int) $data;
170 }
171
172 return $this->version;
173 }
174
181 public function getCreatedAt()
182 {
183 if (is_null($this->createdAt)) {
185 $data = $this->raw(self::FIELD_CREATED_AT);
186 if (is_null($data)) {
187 return null;
188 }
189 $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data);
190 if (false === $data) {
191 return null;
192 }
193 $this->createdAt = $data;
194 }
195
196 return $this->createdAt;
197 }
198
205 public function getLastModifiedAt()
206 {
207 if (is_null($this->lastModifiedAt)) {
209 $data = $this->raw(self::FIELD_LAST_MODIFIED_AT);
210 if (is_null($data)) {
211 return null;
212 }
213 $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data);
214 if (false === $data) {
215 return null;
216 }
217 $this->lastModifiedAt = $data;
218 }
219
221 }
222
229 public function getLastModifiedBy()
230 {
231 if (is_null($this->lastModifiedBy)) {
233 $data = $this->raw(self::FIELD_LAST_MODIFIED_BY);
234 if (is_null($data)) {
235 return null;
236 }
237
238 $this->lastModifiedBy = LastModifiedByModel::of($data);
239 }
240
242 }
243
250 public function getCreatedBy()
251 {
252 if (is_null($this->createdBy)) {
254 $data = $this->raw(self::FIELD_CREATED_BY);
255 if (is_null($data)) {
256 return null;
257 }
258
259 $this->createdBy = CreatedByModel::of($data);
260 }
261
262 return $this->createdBy;
263 }
264
271 public function getKey()
272 {
273 if (is_null($this->key)) {
275 $data = $this->raw(self::FIELD_KEY);
276 if (is_null($data)) {
277 return null;
278 }
279 $this->key = (string) $data;
280 }
281
282 return $this->key;
283 }
284
291 public function getName()
292 {
293 if (is_null($this->name)) {
295 $data = $this->raw(self::FIELD_NAME);
296 if (is_null($data)) {
297 return null;
298 }
299
300 $this->name = LocalizedStringModel::of($data);
301 }
302
303 return $this->name;
304 }
305
312 public function getDescription()
313 {
314 if (is_null($this->description)) {
316 $data = $this->raw(self::FIELD_DESCRIPTION);
317 if (is_null($data)) {
318 return null;
319 }
320
321 $this->description = LocalizedStringModel::of($data);
322 }
323
324 return $this->description;
325 }
326
333 public function getAuthenticationMode()
334 {
335 if (is_null($this->authenticationMode)) {
337 $data = $this->raw(self::FIELD_AUTHENTICATION_MODE);
338 if (is_null($data)) {
339 return null;
340 }
341 $this->authenticationMode = (string) $data;
342 }
343
345 }
346
353 public function getState()
354 {
355 if (is_null($this->state)) {
357 $data = $this->raw(self::FIELD_STATE);
358 if (is_null($data)) {
359 return null;
360 }
361 $this->state = (string) $data;
362 }
363
364 return $this->state;
365 }
366
373 public function getMcpServer()
374 {
375 if (is_null($this->mcpServer)) {
377 $data = $this->raw(self::FIELD_MCP_SERVER);
378 if (is_null($data)) {
379 return null;
380 }
382 $this->mcpServer = $className::of($data);
383 }
384
385 return $this->mcpServer;
386 }
387
388
392 public function setId(?string $id): void
393 {
394 $this->id = $id;
395 }
396
400 public function setVersion(?int $version): void
401 {
402 $this->version = $version;
403 }
404
408 public function setCreatedAt(?DateTimeImmutable $createdAt): void
409 {
410 $this->createdAt = $createdAt;
411 }
412
416 public function setLastModifiedAt(?DateTimeImmutable $lastModifiedAt): void
417 {
418 $this->lastModifiedAt = $lastModifiedAt;
419 }
420
425 {
426 $this->lastModifiedBy = $lastModifiedBy;
427 }
428
432 public function setCreatedBy(?CreatedBy $createdBy): void
433 {
434 $this->createdBy = $createdBy;
435 }
436
440 public function setKey(?string $key): void
441 {
442 $this->key = $key;
443 }
444
448 public function setName(?LocalizedString $name): void
449 {
450 $this->name = $name;
451 }
452
457 {
458 $this->description = $description;
459 }
460
464 public function setAuthenticationMode(?string $authenticationMode): void
465 {
466 $this->authenticationMode = $authenticationMode;
467 }
468
472 public function setState(?string $state): void
473 {
474 $this->state = $state;
475 }
476
481 {
482 $this->mcpServer = $mcpServer;
483 }
484
485
486 #[\ReturnTypeWillChange]
487 public function jsonSerialize()
488 {
489 $data = $this->toArray();
490 if (isset($data[McpServer::FIELD_CREATED_AT]) && $data[McpServer::FIELD_CREATED_AT] instanceof \DateTimeImmutable) {
491 $data[McpServer::FIELD_CREATED_AT] = $data[McpServer::FIELD_CREATED_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c');
492 }
493
494 if (isset($data[McpServer::FIELD_LAST_MODIFIED_AT]) && $data[McpServer::FIELD_LAST_MODIFIED_AT] instanceof \DateTimeImmutable) {
495 $data[McpServer::FIELD_LAST_MODIFIED_AT] = $data[McpServer::FIELD_LAST_MODIFIED_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c');
496 }
497 return (object) $data;
498 }
499}
setLastModifiedBy(?LastModifiedBy $lastModifiedBy)
__construct(?string $id=null, ?int $version=null, ?DateTimeImmutable $createdAt=null, ?DateTimeImmutable $lastModifiedAt=null, ?LastModifiedBy $lastModifiedBy=null, ?CreatedBy $createdBy=null, ?string $key=null, ?LocalizedString $name=null, ?LocalizedString $description=null, ?string $authenticationMode=null, ?string $state=null, ?McpServerConfig $mcpServer=null)
setLastModifiedAt(?DateTimeImmutable $lastModifiedAt)