PluginProbe ʕ •ᴥ•ʔ
Booking for Appointments and Events Calendar – Amelia / 2.4.5
Booking for Appointments and Events Calendar – Amelia v2.4.5
2.4.6 2.4.5 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 / ElicitResult.php
ameliabooking / vendor / wordpress / php-mcp-schema / src / Client / Elicitation / DTO Last commit date
BooleanSchema.php 2 months ago ElicitRequest.php 2 months ago ElicitRequestFormParams.php 2 months ago ElicitRequestFormParamsRequestedSchema.php 2 months ago ElicitRequestURLParams.php 2 months ago ElicitResult.php 2 months ago ElicitationCompleteNotification.php 2 months ago ElicitationCompleteNotificationParams.php 2 months ago LegacyTitledEnumSchema.php 2 months ago NumberSchema.php 2 months ago StringSchema.php 2 months ago TitledMultiSelectEnumSchema.php 2 months ago TitledMultiSelectEnumSchemaItems.php 2 months ago TitledSingleSelectEnumSchema.php 2 months ago UntitledMultiSelectEnumSchema.php 2 months ago UntitledMultiSelectEnumSchemaItems.php 2 months ago UntitledSingleSelectEnumSchema.php 2 months ago
ElicitResult.php
120 lines
1 <?php
2
3 declare(strict_types=1);
4
5 namespace WP\McpSchema\Client\Elicitation\DTO;
6
7 use WP\McpSchema\Client\Lifecycle\Union\ClientResultInterface;
8 use WP\McpSchema\Common\Protocol\DTO\Result;
9 use WP\McpSchema\Common\Traits\ValidatesRequiredFields;
10
11 /**
12 * The client's response to an elicitation request.
13 *
14 * @since 2025-06-18
15 *
16 * @mcp-domain Client
17 * @mcp-subdomain Elicitation
18 * @mcp-version 2025-11-25
19 */
20 class ElicitResult extends Result implements ClientResultInterface
21 {
22 use ValidatesRequiredFields;
23
24 /**
25 * The user action in response to the elicitation.
26 * - "accept": User submitted the form/confirmed the action
27 * - "decline": User explicitly decline the action
28 * - "cancel": User dismissed without making an explicit choice
29 *
30 * @since 2025-06-18
31 *
32 * @var 'accept'|'decline'|'cancel'
33 */
34 protected string $action;
35
36 /**
37 * The submitted form data, only present when action is "accept" and mode was "form".
38 * Contains values matching the requested schema.
39 * Omitted for out-of-band mode responses.
40 *
41 * @since 2025-06-18
42 *
43 * @var array<string, string>|null
44 */
45 protected ?array $content;
46
47 /**
48 * @param 'accept'|'decline'|'cancel' $action @since 2025-06-18
49 * @param array<string, mixed>|null $_meta @since 2025-06-18
50 * @param array<string, string>|null $content @since 2025-06-18
51 */
52 public function __construct(
53 string $action,
54 ?array $_meta = null,
55 ?array $content = null
56 ) {
57 parent::__construct($_meta);
58 $this->action = $action;
59 $this->content = $content;
60 }
61
62 /**
63 * Creates an instance from an array.
64 *
65 * @param array{
66 * _meta?: array<string, mixed>|null,
67 * action: 'accept'|'decline'|'cancel',
68 * content?: array<string, string>|null
69 * } $data
70 * @phpstan-param array<string, mixed> $data
71 * @return self
72 */
73 public static function fromArray(array $data): self
74 {
75 self::assertRequired($data, ['action']);
76
77 /** @var 'accept'|'decline'|'cancel' $action */
78 $action = self::asString($data['action']);
79
80 return new self(
81 $action,
82 self::asArrayOrNull($data['_meta'] ?? null),
83 self::asStringMapOrNull($data['content'] ?? null)
84 );
85 }
86
87 /**
88 * Converts the instance to an array.
89 *
90 * @return array<string, mixed>
91 */
92 public function toArray(): array
93 {
94 $result = parent::toArray();
95
96 $result['action'] = $this->action;
97 if ($this->content !== null) {
98 $result['content'] = $this->content;
99 }
100
101 return $result;
102 }
103
104 /**
105 * @return 'accept'|'decline'|'cancel'
106 */
107 public function getAction(): string
108 {
109 return $this->action;
110 }
111
112 /**
113 * @return array<string, string>|null
114 */
115 public function getContent(): ?array
116 {
117 return $this->content;
118 }
119 }
120