PluginProbe
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages / 3.4.3
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages v3.4.3
3.4.3 3.4.2 3.4.1 3.4.0 3.3.9 3.3.8 3.3.7 3.3.6 3.3.5 3.3.4 3.3.3 3.3.2 3.3.1 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.2.7 2.2.8 2.2.9 2.3.0 2.3.1 All 196 releases
convertkit / vendor / wordpress / php-mcp-schema / src / Common / Protocol / DTO / CancelledNotificationParams.php

CancelledNotificationParams.php in Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages 3.4.3, at vendor/wordpress/php-mcp-schema/src/Common/Protocol/DTO/CancelledNotificationParams.php

120 lines 2.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 declare(strict_types=1);
4
5 namespace WP\McpSchema\Common\Protocol\DTO;
6
7 use WP\McpSchema\Common\JsonRpc\DTO\NotificationParams;
8 use WP\McpSchema\Common\Traits\ValidatesRequiredFields;
9
10 /**
11 * Parameters for a `notifications/cancelled` notification.
12 *
13 * @since 2025-11-25
14 *
15 * @mcp-domain Common
16 * @mcp-subdomain Protocol
17 * @mcp-version 2025-11-25
18 */
19 class CancelledNotificationParams extends NotificationParams
20 {
21 use ValidatesRequiredFields;
22
23 /**
24 * The ID of the request to cancel.
25 *
26 * This MUST correspond to the ID of a request previously issued in the same direction.
27 * This MUST be provided for cancelling non-task requests.
28 * This MUST NOT be used for cancelling tasks (use the `tasks/cancel` request instead).
29 *
30 * @since 2025-11-25
31 *
32 * @var string|number|null
33 */
34 protected $requestId;
35
36 /**
37 * An optional string describing the reason for the cancellation. This MAY be logged or presented to the user.
38 *
39 * @since 2025-11-25
40 *
41 * @var string|null
42 */
43 protected ?string $reason;
44
45 /**
46 * @param array<string, mixed>|null $_meta @since 2025-11-25
47 * @param string|number|null $requestId @since 2025-11-25
48 * @param string|null $reason @since 2025-11-25
49 */
50 public function __construct(
51 ?array $_meta = null,
52 $requestId = null,
53 ?string $reason = null
54 ) {
55 parent::__construct($_meta);
56 $this->requestId = $requestId;
57 $this->reason = $reason;
58 }
59
60 /**
61 * Creates an instance from an array.
62 *
63 * @param array{
64 * _meta?: array<string, mixed>|null,
65 * requestId?: string|number|null,
66 * reason?: string|null
67 * } $data
68 * @phpstan-param array<string, mixed> $data
69 * @return self
70 */
71 public static function fromArray(array $data): self
72 {
73 /** @var string|number|null $requestId */
74 $requestId = isset($data['requestId'])
75 ? self::asStringOrNumberOrNull($data['requestId'])
76 : null;
77
78 return new self(
79 self::asArrayOrNull($data['_meta'] ?? null),
80 $requestId,
81 self::asStringOrNull($data['reason'] ?? null)
82 );
83 }
84
85 /**
86 * Converts the instance to an array.
87 *
88 * @return array<string, mixed>
89 */
90 public function toArray(): array
91 {
92 $result = parent::toArray();
93
94 if ($this->requestId !== null) {
95 $result['requestId'] = $this->requestId;
96 }
97 if ($this->reason !== null) {
98 $result['reason'] = $this->reason;
99 }
100
101 return $result;
102 }
103
104 /**
105 * @return string|number|null
106 */
107 public function getRequestId()
108 {
109 return $this->requestId;
110 }
111
112 /**
113 * @return string|null
114 */
115 public function getReason(): ?string
116 {
117 return $this->reason;
118 }
119 }
120