PluginProbe
ZIP AI – AI Website Builder & AI Agent (Beta) / 0.0.8
ZIP AI – AI Website Builder & AI Agent (Beta) v0.0.8
0.0.10 0.0.9 trunk 0.0.4 0.0.5 0.0.6 0.0.7 0.0.8
zip-ai / lib / php-mcp-schema / src / Server / Logging / DTO / SetLevelRequestParams.php

SetLevelRequestParams.php in ZIP AI – AI Website Builder & AI Agent (Beta) 0.0.8, at lib/php-mcp-schema/src/Server/Logging/DTO/SetLevelRequestParams.php

97 lines 2.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 declare(strict_types=1);
4
5 namespace WP\McpSchema\Server\Logging\DTO;
6
7 use WP\McpSchema\Common\JsonRpc\DTO\RequestParams;
8 use WP\McpSchema\Common\JsonRpc\DTO\RequestParamsMeta;
9 use WP\McpSchema\Common\Traits\ValidatesRequiredFields;
10
11 /**
12 * Parameters for a `logging/setLevel` request.
13 *
14 * @since 2025-11-25
15 *
16 * @mcp-domain Server
17 * @mcp-subdomain Logging
18 * @mcp-version 2025-11-25
19 */
20 class SetLevelRequestParams extends RequestParams
21 {
22 use ValidatesRequiredFields;
23
24 /**
25 * The level of logging that the client wants to receive from the server. The server should send all logs at this level and higher (i.e., more severe) to the client as notifications/message.
26 *
27 * @since 2025-11-25
28 *
29 * @var 'debug'|'info'|'notice'|'warning'|'error'|'critical'|'alert'|'emergency'
30 */
31 protected string $level;
32
33 /**
34 * @param 'debug'|'info'|'notice'|'warning'|'error'|'critical'|'alert'|'emergency' $level @since 2025-11-25
35 * @param \WP\McpSchema\Common\JsonRpc\DTO\RequestParamsMeta|null $_meta @since 2025-11-25
36 */
37 public function __construct(
38 string $level,
39 ?RequestParamsMeta $_meta = null
40 ) {
41 parent::__construct($_meta);
42 $this->level = $level;
43 }
44
45 /**
46 * Creates an instance from an array.
47 *
48 * @param array{
49 * _meta?: array<string, mixed>|\WP\McpSchema\Common\JsonRpc\DTO\RequestParamsMeta|null,
50 * level: 'debug'|'info'|'notice'|'warning'|'error'|'critical'|'alert'|'emergency'
51 * } $data
52 * @phpstan-param array<string, mixed> $data
53 * @return self
54 */
55 public static function fromArray(array $data): self
56 {
57 self::assertRequired($data, ['level']);
58
59 /** @var 'debug'|'info'|'notice'|'warning'|'error'|'critical'|'alert'|'emergency' $level */
60 $level = self::asString($data['level']);
61
62 /** @var \WP\McpSchema\Common\JsonRpc\DTO\RequestParamsMeta|null $_meta */
63 $_meta = isset($data['_meta'])
64 ? (is_array($data['_meta'])
65 ? RequestParamsMeta::fromArray(self::asArray($data['_meta']))
66 : $data['_meta'])
67 : null;
68
69 return new self(
70 $level,
71 $_meta
72 );
73 }
74
75 /**
76 * Converts the instance to an array.
77 *
78 * @return array<string, mixed>
79 */
80 public function toArray(): array
81 {
82 $result = parent::toArray();
83
84 $result['level'] = $this->level;
85
86 return $result;
87 }
88
89 /**
90 * @return 'debug'|'info'|'notice'|'warning'|'error'|'critical'|'alert'|'emergency'
91 */
92 public function getLevel(): string
93 {
94 return $this->level;
95 }
96 }
97