PluginProbe
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell / 3.13.3
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell v3.13.3
3.13.3 3.13.2 3.13.1 3.13.0 3.12.13 3.12.12 3.12.11 3.12.10 3.12.9 3.12.8 3.12.7 3.12.6 3.12.5 3.12.4 3.12.3 3.12.1 3.12.2 3.12.0 3.11.1 3.11.0 3.10.9 3.10.8 3.10.7 3.10.6 2.8.16 All 261 releases
wpfunnels / vendor / wordpress / php-mcp-schema / src / Server / Resources / DTO / ResourceRequestParams.php

ResourceRequestParams.php in WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell 3.13.3, at vendor/wordpress/php-mcp-schema/src/Server/Resources/DTO/ResourceRequestParams.php

94 lines 2.1 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\Server\Resources\DTO;
6
7 use WP\McpSchema\Common\JsonRpc\DTO\RequestParams;
8 use WP\McpSchema\Common\JsonRpc\DTO\RequestParamsMeta;
9 use WP\McpSchema\Common\Traits\ValidatesRequiredFields;
10
11 /**
12 * Common parameters when working with resources.
13 *
14 * @since 2025-11-25
15 *
16 * @mcp-domain Server
17 * @mcp-subdomain Resources
18 * @mcp-version 2025-11-25
19 */
20 class ResourceRequestParams extends RequestParams
21 {
22 use ValidatesRequiredFields;
23
24 /**
25 * The URI of the resource. The URI can use any protocol; it is up to the server how to interpret it.
26 *
27 * @since 2025-11-25
28 *
29 * @var string
30 */
31 protected string $uri;
32
33 /**
34 * @param string $uri @since 2025-11-25
35 * @param \WP\McpSchema\Common\JsonRpc\DTO\RequestParamsMeta|null $_meta @since 2025-11-25
36 */
37 public function __construct(
38 string $uri,
39 ?RequestParamsMeta $_meta = null
40 ) {
41 parent::__construct($_meta);
42 $this->uri = $uri;
43 }
44
45 /**
46 * Creates an instance from an array.
47 *
48 * @param array{
49 * _meta?: array<string, mixed>|\WP\McpSchema\Common\JsonRpc\DTO\RequestParamsMeta|null,
50 * uri: string
51 * } $data
52 * @phpstan-param array<string, mixed> $data
53 * @return self
54 */
55 public static function fromArray(array $data): self
56 {
57 self::assertRequired($data, ['uri']);
58
59 /** @var \WP\McpSchema\Common\JsonRpc\DTO\RequestParamsMeta|null $_meta */
60 $_meta = isset($data['_meta'])
61 ? (is_array($data['_meta'])
62 ? RequestParamsMeta::fromArray(self::asArray($data['_meta']))
63 : $data['_meta'])
64 : null;
65
66 return new self(
67 self::asString($data['uri']),
68 $_meta
69 );
70 }
71
72 /**
73 * Converts the instance to an array.
74 *
75 * @return array<string, mixed>
76 */
77 public function toArray(): array
78 {
79 $result = parent::toArray();
80
81 $result['uri'] = $this->uri;
82
83 return $result;
84 }
85
86 /**
87 * @return string
88 */
89 public function getUri(): string
90 {
91 return $this->uri;
92 }
93 }
94