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.11 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 / Core / DTO / CompleteRequestParamsArgument.php

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

98 lines 1.8 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\Core\DTO;
6
7 use WP\McpSchema\Common\AbstractDataTransferObject;
8 use WP\McpSchema\Common\Traits\ValidatesRequiredFields;
9
10 /**
11 * The argument's information
12 *
13 * @mcp-domain Server
14 * @mcp-subdomain Core
15 * @mcp-version 2025-11-25
16 */
17 class CompleteRequestParamsArgument extends AbstractDataTransferObject
18 {
19 use ValidatesRequiredFields;
20
21 /**
22 * The name of the argument
23 *
24 * @var string
25 */
26 protected string $name;
27
28 /**
29 * The value of the argument to use for completion matching.
30 *
31 * @var string
32 */
33 protected string $value;
34
35 /**
36 * @param string $name
37 * @param string $value
38 */
39 public function __construct(
40 string $name,
41 string $value
42 ) {
43 $this->name = $name;
44 $this->value = $value;
45 }
46
47 /**
48 * Creates an instance from an array.
49 *
50 * @param array{
51 * name: string,
52 * value: string
53 * } $data
54 * @phpstan-param array<string, mixed> $data
55 * @return self
56 */
57 public static function fromArray(array $data): self
58 {
59 self::assertRequired($data, ['name', 'value']);
60
61 return new self(
62 self::asString($data['name']),
63 self::asString($data['value'])
64 );
65 }
66
67 /**
68 * Converts the instance to an array.
69 *
70 * @return array<string, mixed>
71 */
72 public function toArray(): array
73 {
74 $result = [];
75
76 $result['name'] = $this->name;
77 $result['value'] = $this->value;
78
79 return $result;
80 }
81
82 /**
83 * @return string
84 */
85 public function getName(): string
86 {
87 return $this->name;
88 }
89
90 /**
91 * @return string
92 */
93 public function getValue(): string
94 {
95 return $this->value;
96 }
97 }
98