PluginProbe ʕ •ᴥ•ʔ
Booking for Appointments and Events Calendar – Amelia / trunk
Booking for Appointments and Events Calendar – Amelia vtrunk
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 / Tasks / DTO / CreateTaskResult.php
ameliabooking / vendor / wordpress / php-mcp-schema / src / Client / Tasks / DTO Last commit date
CreateTaskResult.php 1 month ago RelatedTaskMetadata.php 1 month ago Task.php 1 month ago TaskMetadata.php 1 month ago
CreateTaskResult.php
89 lines
1 <?php
2
3 declare(strict_types=1);
4
5 namespace WP\McpSchema\Client\Tasks\DTO;
6
7 use WP\McpSchema\Common\Protocol\DTO\Result;
8 use WP\McpSchema\Common\Traits\ValidatesRequiredFields;
9
10 /**
11 * A response to a task-augmented request.
12 *
13 * @since 2025-11-25
14 *
15 * @mcp-domain Client
16 * @mcp-subdomain Tasks
17 * @mcp-version 2025-11-25
18 */
19 class CreateTaskResult extends Result
20 {
21 use ValidatesRequiredFields;
22
23 /**
24 * @since 2025-11-25
25 *
26 * @var \WP\McpSchema\Client\Tasks\DTO\Task
27 */
28 protected Task $task;
29
30 /**
31 * @param \WP\McpSchema\Client\Tasks\DTO\Task $task @since 2025-11-25
32 * @param array<string, mixed>|null $_meta @since 2025-11-25
33 */
34 public function __construct(
35 Task $task,
36 ?array $_meta = null
37 ) {
38 parent::__construct($_meta);
39 $this->task = $task;
40 }
41
42 /**
43 * Creates an instance from an array.
44 *
45 * @param array{
46 * _meta?: array<string, mixed>|null,
47 * task: array<string, mixed>|\WP\McpSchema\Client\Tasks\DTO\Task
48 * } $data
49 * @phpstan-param array<string, mixed> $data
50 * @return self
51 */
52 public static function fromArray(array $data): self
53 {
54 self::assertRequired($data, ['task']);
55
56 /** @var \WP\McpSchema\Client\Tasks\DTO\Task $task */
57 $task = is_array($data['task'])
58 ? Task::fromArray(self::asArray($data['task']))
59 : $data['task'];
60
61 return new self(
62 $task,
63 self::asArrayOrNull($data['_meta'] ?? null)
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 = parent::toArray();
75
76 $result['task'] = $this->task->toArray();
77
78 return $result;
79 }
80
81 /**
82 * @return \WP\McpSchema\Client\Tasks\DTO\Task
83 */
84 public function getTask(): Task
85 {
86 return $this->task;
87 }
88 }
89