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 / BooleanSchema.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
BooleanSchema.php
147 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 *
14 * @mcp-domain Client
15 * @mcp-subdomain Elicitation
16 * @mcp-version 2025-11-25
17 */
18 class BooleanSchema extends AbstractDataTransferObject implements PrimitiveSchemaDefinitionInterface
19 {
20 use ValidatesRequiredFields;
21
22 public const TYPE = 'boolean';
23
24 public const DISCRIMINATOR_FIELD = 'type';
25 public const DISCRIMINATOR_VALUE = 'boolean';
26
27 /**
28 * @since 2025-06-18
29 *
30 * @var 'boolean'
31 */
32 protected string $type;
33
34 /**
35 * @since 2025-06-18
36 *
37 * @var string|null
38 */
39 protected ?string $title;
40
41 /**
42 * @since 2025-06-18
43 *
44 * @var string|null
45 */
46 protected ?string $description;
47
48 /**
49 * @since 2025-06-18
50 *
51 * @var bool|null
52 */
53 protected ?bool $default;
54
55 /**
56 * @param string|null $title @since 2025-06-18
57 * @param string|null $description @since 2025-06-18
58 * @param bool|null $default @since 2025-06-18
59 */
60 public function __construct(
61 ?string $title = null,
62 ?string $description = null,
63 ?bool $default = null
64 ) {
65 $this->type = self::TYPE;
66 $this->title = $title;
67 $this->description = $description;
68 $this->default = $default;
69 }
70
71 /**
72 * Creates an instance from an array.
73 *
74 * @param array{
75 * type: 'boolean',
76 * title?: string|null,
77 * description?: string|null,
78 * default?: bool|null
79 * } $data
80 * @phpstan-param array<string, mixed> $data
81 * @return self
82 */
83 public static function fromArray(array $data): self
84 {
85 return new self(
86 self::asStringOrNull($data['title'] ?? null),
87 self::asStringOrNull($data['description'] ?? null),
88 self::asBoolOrNull($data['default'] ?? null)
89 );
90 }
91
92 /**
93 * Converts the instance to an array.
94 *
95 * @return array<string, mixed>
96 */
97 public function toArray(): array
98 {
99 $result = [];
100
101 $result['type'] = $this->type;
102 if ($this->title !== null) {
103 $result['title'] = $this->title;
104 }
105 if ($this->description !== null) {
106 $result['description'] = $this->description;
107 }
108 if ($this->default !== null) {
109 $result['default'] = $this->default;
110 }
111
112 return $result;
113 }
114
115 /**
116 * @return 'boolean'
117 */
118 public function getType(): string
119 {
120 return $this->type;
121 }
122
123 /**
124 * @return string|null
125 */
126 public function getTitle(): ?string
127 {
128 return $this->title;
129 }
130
131 /**
132 * @return string|null
133 */
134 public function getDescription(): ?string
135 {
136 return $this->description;
137 }
138
139 /**
140 * @return bool|null
141 */
142 public function getDefault(): ?bool
143 {
144 return $this->default;
145 }
146 }
147