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 / NumberSchema.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
NumberSchema.php
197 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\PrimitiveSchemaDefinitionInterface;
8 use WP\McpSchema\Common\AbstractDataTransferObject;
9 use WP\McpSchema\Common\Traits\ValidatesRequiredFields;
10
11 /**
12 * @since 2025-06-18
13 * @last-updated 2025-11-25 (added properties: default)
14 *
15 * @mcp-domain Client
16 * @mcp-subdomain Elicitation
17 * @mcp-version 2025-11-25
18 */
19 class NumberSchema extends AbstractDataTransferObject implements PrimitiveSchemaDefinitionInterface
20 {
21 use ValidatesRequiredFields;
22
23 /**
24 * @since 2025-06-18
25 *
26 * @var 'number'|'integer'
27 */
28 protected string $type;
29
30 /**
31 * @since 2025-06-18
32 *
33 * @var string|null
34 */
35 protected ?string $title;
36
37 /**
38 * @since 2025-06-18
39 *
40 * @var string|null
41 */
42 protected ?string $description;
43
44 /**
45 * @since 2025-06-18
46 *
47 * @var float|null
48 */
49 protected ?float $minimum;
50
51 /**
52 * @since 2025-06-18
53 *
54 * @var float|null
55 */
56 protected ?float $maximum;
57
58 /**
59 * @since 2025-11-25
60 *
61 * @var float|null
62 */
63 protected ?float $default;
64
65 /**
66 * @param 'number'|'integer' $type @since 2025-06-18
67 * @param string|null $title @since 2025-06-18
68 * @param string|null $description @since 2025-06-18
69 * @param float|null $minimum @since 2025-06-18
70 * @param float|null $maximum @since 2025-06-18
71 * @param float|null $default @since 2025-11-25
72 */
73 public function __construct(
74 string $type,
75 ?string $title = null,
76 ?string $description = null,
77 ?float $minimum = null,
78 ?float $maximum = null,
79 ?float $default = null
80 ) {
81 $this->type = $type;
82 $this->title = $title;
83 $this->description = $description;
84 $this->minimum = $minimum;
85 $this->maximum = $maximum;
86 $this->default = $default;
87 }
88
89 /**
90 * Creates an instance from an array.
91 *
92 * @param array{
93 * type: 'number'|'integer',
94 * title?: string|null,
95 * description?: string|null,
96 * minimum?: float|null,
97 * maximum?: float|null,
98 * default?: float|null
99 * } $data
100 * @phpstan-param array<string, mixed> $data
101 * @return self
102 */
103 public static function fromArray(array $data): self
104 {
105 self::assertRequired($data, ['type']);
106
107 /** @var 'number'|'integer' $type */
108 $type = self::asString($data['type']);
109
110 return new self(
111 $type,
112 self::asStringOrNull($data['title'] ?? null),
113 self::asStringOrNull($data['description'] ?? null),
114 self::asFloatOrNull($data['minimum'] ?? null),
115 self::asFloatOrNull($data['maximum'] ?? null),
116 self::asFloatOrNull($data['default'] ?? null)
117 );
118 }
119
120 /**
121 * Converts the instance to an array.
122 *
123 * @return array<string, mixed>
124 */
125 public function toArray(): array
126 {
127 $result = [];
128
129 $result['type'] = $this->type;
130 if ($this->title !== null) {
131 $result['title'] = $this->title;
132 }
133 if ($this->description !== null) {
134 $result['description'] = $this->description;
135 }
136 if ($this->minimum !== null) {
137 $result['minimum'] = $this->minimum;
138 }
139 if ($this->maximum !== null) {
140 $result['maximum'] = $this->maximum;
141 }
142 if ($this->default !== null) {
143 $result['default'] = $this->default;
144 }
145
146 return $result;
147 }
148
149 /**
150 * @return 'number'|'integer'
151 */
152 public function getType(): string
153 {
154 return $this->type;
155 }
156
157 /**
158 * @return string|null
159 */
160 public function getTitle(): ?string
161 {
162 return $this->title;
163 }
164
165 /**
166 * @return string|null
167 */
168 public function getDescription(): ?string
169 {
170 return $this->description;
171 }
172
173 /**
174 * @return float|null
175 */
176 public function getMinimum(): ?float
177 {
178 return $this->minimum;
179 }
180
181 /**
182 * @return float|null
183 */
184 public function getMaximum(): ?float
185 {
186 return $this->maximum;
187 }
188
189 /**
190 * @return float|null
191 */
192 public function getDefault(): ?float
193 {
194 return $this->default;
195 }
196 }
197