PluginProbe
Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF / 2.3.1
Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF v2.3.1
2.3.4 2.3.3 2.3.2 2.3.1 2.3.0 2.2.9 2.2.8 trunk 1.10 1.3.3 1.3.4 1.3.5 1.3.5.1 1.3.5.2 1.3.6 1.3.6.1 1.4 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.5 All 103 releases
imagify / vendor / wordpress / php-mcp-schema / src / Common / JsonRpc / DTO / RequestParamsMeta.php

RequestParamsMeta.php in Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF 2.3.1, at vendor/wordpress/php-mcp-schema/src/Common/JsonRpc/DTO/RequestParamsMeta.php

82 lines 2.0 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\JsonRpc\DTO;
6
7 use WP\McpSchema\Common\AbstractDataTransferObject;
8 use WP\McpSchema\Common\Traits\ValidatesRequiredFields;
9
10 /**
11 * See [General fields: `_meta`](/specification/2025-11-25/basic/index#meta) for notes on `_meta` usage.
12 *
13 * @mcp-domain Common
14 * @mcp-subdomain JsonRpc
15 * @mcp-version 2025-11-25
16 */
17 class RequestParamsMeta extends AbstractDataTransferObject
18 {
19 use ValidatesRequiredFields;
20
21 /**
22 * If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.
23 *
24 * @var string|number|null
25 */
26 protected $progressToken;
27
28 /**
29 * @param string|number|null $progressToken
30 */
31 public function __construct(
32 $progressToken = null
33 ) {
34 $this->progressToken = $progressToken;
35 }
36
37 /**
38 * Creates an instance from an array.
39 *
40 * @param array{
41 * progressToken?: string|number|null
42 * } $data
43 * @phpstan-param array<string, mixed> $data
44 * @return self
45 */
46 public static function fromArray(array $data): self
47 {
48 /** @var string|number|null $progressToken */
49 $progressToken = isset($data['progressToken'])
50 ? self::asStringOrNumberOrNull($data['progressToken'])
51 : null;
52
53 return new self(
54 $progressToken
55 );
56 }
57
58 /**
59 * Converts the instance to an array.
60 *
61 * @return array<string, mixed>
62 */
63 public function toArray(): array
64 {
65 $result = [];
66
67 if ($this->progressToken !== null) {
68 $result['progressToken'] = $this->progressToken;
69 }
70
71 return $result;
72 }
73
74 /**
75 * @return string|number|null
76 */
77 public function getProgressToken()
78 {
79 return $this->progressToken;
80 }
81 }
82