cursor = $cursor; } /** * Creates an instance from an array. * * @param array{ * _meta?: array|\WP\McpSchema\Common\JsonRpc\DTO\RequestParamsMeta|null, * cursor?: string|null * } $data * @phpstan-param array $data * @return self */ public static function fromArray(array $data): self { /** @var \WP\McpSchema\Common\JsonRpc\DTO\RequestParamsMeta|null $_meta */ $_meta = isset($data['_meta']) ? (is_array($data['_meta']) ? RequestParamsMeta::fromArray(self::asArray($data['_meta'])) : $data['_meta']) : null; return new self( $_meta, self::asStringOrNull($data['cursor'] ?? null) ); } /** * Converts the instance to an array. * * @return array */ public function toArray(): array { $result = parent::toArray(); if ($this->cursor !== null) { $result['cursor'] = $this->cursor; } return $result; } /** * @return string|null */ public function getCursor(): ?string { return $this->cursor; } }