PluginProbe ʕ •ᴥ•ʔ
CommerceBird – AI Command Center, ERP Integrations & B2B for WooCommerce (Zoho, Exact Online). / trunk
CommerceBird – AI Command Center, ERP Integrations & B2B for WooCommerce (Zoho, Exact Online). vtrunk
3.0.3 3.0.2 3.0.1 trunk 2.2.14 2.2.15 2.2.16 2.2.17 2.2.18 2.2.19 2.3.0 2.3.1 2.3.10 2.3.11 2.3.12 2.3.13 2.3.14 2.3.2 2.3.3 2.3.4 2.3.5 2.3.6 2.3.7 2.3.8 2.3.9 2.4.0 2.4.1 2.4.2 2.4.3 2.4.4 2.4.5 2.4.6 2.5.0 2.5.1 2.5.2 2.6.0 2.6.1 2.6.2 2.6.3 2.6.4 2.6.5 2.7.0 2.7.1 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 2.7.8 2.7.9 2.7.91 2.7.92 2.7.93 2.8.0 2.8.1 2.8.2 2.8.3 2.8.4 2.8.5 2.9.0 2.9.1 2.9.2 2.9.3 3.0.0
commercebird / vendor / wordpress / php-mcp-schema / src / Client / Tasks / DTO / CreateTaskResult.php
commercebird / vendor / wordpress / php-mcp-schema / src / Client / Tasks / DTO Last commit date
CreateTaskResult.php 2 months ago RelatedTaskMetadata.php 2 months ago Task.php 2 months ago TaskMetadata.php 2 months 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