PluginProbe ʕ •ᴥ•ʔ
Booking for Appointments and Events Calendar – Amelia / 2.4.4
Booking for Appointments and Events Calendar – Amelia v2.4.4
2.4.4 2.4.3 2.4.2 2.4.1 2.4 trunk 1.2.1 1.2.10 1.2.11 1.2.12 1.2.13 1.2.14 1.2.15 1.2.16 1.2.17 1.2.18 1.2.19 1.2.2 1.2.20 1.2.21 1.2.22 1.2.23 1.2.24 1.2.25 1.2.26 1.2.27 1.2.28 1.2.29 1.2.3 1.2.30 1.2.31 1.2.32 1.2.33 1.2.34 1.2.35 1.2.36 1.2.37 1.2.38 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 2.0 2.0.1 2.0.2 2.1 2.1.1 2.1.2 2.1.3 2.2 2.2.1 2.3
ameliabooking / vendor / wordpress / php-mcp-schema / src / Client / Elicitation / DTO / UntitledMultiSelectEnumSchema.php
ameliabooking / vendor / wordpress / php-mcp-schema / src / Client / Elicitation / DTO Last commit date
BooleanSchema.php 1 month ago ElicitRequest.php 1 month ago ElicitRequestFormParams.php 1 month ago ElicitRequestFormParamsRequestedSchema.php 1 month ago ElicitRequestURLParams.php 1 month ago ElicitResult.php 1 month ago ElicitationCompleteNotification.php 1 month ago ElicitationCompleteNotificationParams.php 1 month ago LegacyTitledEnumSchema.php 1 month ago NumberSchema.php 1 month ago StringSchema.php 1 month ago TitledMultiSelectEnumSchema.php 1 month ago TitledMultiSelectEnumSchemaItems.php 1 month ago TitledSingleSelectEnumSchema.php 1 month ago UntitledMultiSelectEnumSchema.php 1 month ago UntitledMultiSelectEnumSchemaItems.php 1 month ago UntitledSingleSelectEnumSchema.php 1 month ago
UntitledMultiSelectEnumSchema.php
235 lines
1 <?php
2
3 declare(strict_types=1);
4
5 namespace WP\McpSchema\Client\Elicitation\DTO;
6
7 use WP\McpSchema\Client\Elicitation\Union\MultiSelectEnumSchemaInterface;
8 use WP\McpSchema\Common\AbstractDataTransferObject;
9 use WP\McpSchema\Common\Traits\ValidatesRequiredFields;
10
11 /**
12 * Schema for multiple-selection enumeration without display titles for options.
13 *
14 * @since 2025-11-25
15 *
16 * @mcp-domain Client
17 * @mcp-subdomain Elicitation
18 * @mcp-version 2025-11-25
19 */
20 class UntitledMultiSelectEnumSchema extends AbstractDataTransferObject implements MultiSelectEnumSchemaInterface
21 {
22 use ValidatesRequiredFields;
23
24 public const TYPE = 'array';
25
26 public const DISCRIMINATOR_FIELD = 'type';
27 public const DISCRIMINATOR_VALUE = 'array';
28
29 /**
30 * @since 2025-11-25
31 *
32 * @var 'array'
33 */
34 protected string $type;
35
36 /**
37 * Optional title for the enum field.
38 *
39 * @since 2025-11-25
40 *
41 * @var string|null
42 */
43 protected ?string $title;
44
45 /**
46 * Optional description for the enum field.
47 *
48 * @since 2025-11-25
49 *
50 * @var string|null
51 */
52 protected ?string $description;
53
54 /**
55 * Minimum number of items to select.
56 *
57 * @since 2025-11-25
58 *
59 * @var int|null
60 */
61 protected ?int $minItems;
62
63 /**
64 * Maximum number of items to select.
65 *
66 * @since 2025-11-25
67 *
68 * @var int|null
69 */
70 protected ?int $maxItems;
71
72 /**
73 * Schema for the array items.
74 *
75 * @since 2025-11-25
76 *
77 * @var \WP\McpSchema\Client\Elicitation\DTO\UntitledMultiSelectEnumSchemaItems
78 */
79 protected UntitledMultiSelectEnumSchemaItems $items;
80
81 /**
82 * Optional default value.
83 *
84 * @since 2025-11-25
85 *
86 * @var array<string>|null
87 */
88 protected ?array $default;
89
90 /**
91 * @param \WP\McpSchema\Client\Elicitation\DTO\UntitledMultiSelectEnumSchemaItems $items @since 2025-11-25
92 * @param string|null $title @since 2025-11-25
93 * @param string|null $description @since 2025-11-25
94 * @param int|null $minItems @since 2025-11-25
95 * @param int|null $maxItems @since 2025-11-25
96 * @param array<string>|null $default @since 2025-11-25
97 */
98 public function __construct(
99 UntitledMultiSelectEnumSchemaItems $items,
100 ?string $title = null,
101 ?string $description = null,
102 ?int $minItems = null,
103 ?int $maxItems = null,
104 ?array $default = null
105 ) {
106 $this->type = self::TYPE;
107 $this->items = $items;
108 $this->title = $title;
109 $this->description = $description;
110 $this->minItems = $minItems;
111 $this->maxItems = $maxItems;
112 $this->default = $default;
113 }
114
115 /**
116 * Creates an instance from an array.
117 *
118 * @param array{
119 * type: 'array',
120 * title?: string|null,
121 * description?: string|null,
122 * minItems?: int|null,
123 * maxItems?: int|null,
124 * items: array<string, mixed>|\WP\McpSchema\Client\Elicitation\DTO\UntitledMultiSelectEnumSchemaItems,
125 * default?: array<string>|null
126 * } $data
127 * @phpstan-param array<string, mixed> $data
128 * @return self
129 */
130 public static function fromArray(array $data): self
131 {
132 self::assertRequired($data, ['items']);
133
134 /** @var \WP\McpSchema\Client\Elicitation\DTO\UntitledMultiSelectEnumSchemaItems $items */
135 $items = is_array($data['items'])
136 ? UntitledMultiSelectEnumSchemaItems::fromArray(self::asArray($data['items']))
137 : $data['items'];
138
139 return new self(
140 $items,
141 self::asStringOrNull($data['title'] ?? null),
142 self::asStringOrNull($data['description'] ?? null),
143 self::asIntOrNull($data['minItems'] ?? null),
144 self::asIntOrNull($data['maxItems'] ?? null),
145 self::asStringArrayOrNull($data['default'] ?? null)
146 );
147 }
148
149 /**
150 * Converts the instance to an array.
151 *
152 * @return array<string, mixed>
153 */
154 public function toArray(): array
155 {
156 $result = [];
157
158 $result['type'] = $this->type;
159 if ($this->title !== null) {
160 $result['title'] = $this->title;
161 }
162 if ($this->description !== null) {
163 $result['description'] = $this->description;
164 }
165 if ($this->minItems !== null) {
166 $result['minItems'] = $this->minItems;
167 }
168 if ($this->maxItems !== null) {
169 $result['maxItems'] = $this->maxItems;
170 }
171 $result['items'] = $this->items->toArray();
172 if ($this->default !== null) {
173 $result['default'] = $this->default;
174 }
175
176 return $result;
177 }
178
179 /**
180 * @return 'array'
181 */
182 public function getType(): string
183 {
184 return $this->type;
185 }
186
187 /**
188 * @return string|null
189 */
190 public function getTitle(): ?string
191 {
192 return $this->title;
193 }
194
195 /**
196 * @return string|null
197 */
198 public function getDescription(): ?string
199 {
200 return $this->description;
201 }
202
203 /**
204 * @return int|null
205 */
206 public function getMinItems(): ?int
207 {
208 return $this->minItems;
209 }
210
211 /**
212 * @return int|null
213 */
214 public function getMaxItems(): ?int
215 {
216 return $this->maxItems;
217 }
218
219 /**
220 * @return \WP\McpSchema\Client\Elicitation\DTO\UntitledMultiSelectEnumSchemaItems
221 */
222 public function getItems(): UntitledMultiSelectEnumSchemaItems
223 {
224 return $this->items;
225 }
226
227 /**
228 * @return array<string>|null
229 */
230 public function getDefault(): ?array
231 {
232 return $this->default;
233 }
234 }
235