| 1 |
<?php |
| 2 |
|
| 3 |
declare(strict_types=1); |
| 4 |
|
| 5 |
namespace WP\McpSchema\Common\Protocol\DTO; |
| 6 |
|
| 7 |
use WP\McpSchema\Common\AbstractDataTransferObject; |
| 8 |
use WP\McpSchema\Common\Traits\ValidatesRequiredFields; |
| 9 |
|
| 10 |
/** |
| 11 |
* An error response that indicates that the server requires the client to provide additional information via an elicitation request. |
| 12 |
* |
| 13 |
* @since 2025-11-25 |
| 14 |
* |
| 15 |
* @mcp-domain Common |
| 16 |
* @mcp-subdomain Protocol |
| 17 |
* @mcp-version 2025-11-25 |
| 18 |
*/ |
| 19 |
class URLElicitationRequiredError extends AbstractDataTransferObject |
| 20 |
{ |
| 21 |
use ValidatesRequiredFields; |
| 22 |
|
| 23 |
/** |
| 24 |
* @since 2025-11-25 |
| 25 |
* |
| 26 |
* @var mixed |
| 27 |
*/ |
| 28 |
protected $error; |
| 29 |
|
| 30 |
/** |
| 31 |
* @param mixed $error @since 2025-11-25 |
| 32 |
*/ |
| 33 |
public function __construct( |
| 34 |
$error |
| 35 |
) { |
| 36 |
$this->error = $error; |
| 37 |
} |
| 38 |
|
| 39 |
/** |
| 40 |
* Creates an instance from an array. |
| 41 |
* |
| 42 |
* @param array{ |
| 43 |
* error: mixed |
| 44 |
* } $data |
| 45 |
* @phpstan-param array<string, mixed> $data |
| 46 |
* @return self |
| 47 |
*/ |
| 48 |
public static function fromArray(array $data): self |
| 49 |
{ |
| 50 |
self::assertRequired($data, ['error']); |
| 51 |
|
| 52 |
return new self( |
| 53 |
$data['error'] |
| 54 |
); |
| 55 |
} |
| 56 |
|
| 57 |
/** |
| 58 |
* Converts the instance to an array. |
| 59 |
* |
| 60 |
* @return array<string, mixed> |
| 61 |
*/ |
| 62 |
public function toArray(): array |
| 63 |
{ |
| 64 |
$result = []; |
| 65 |
|
| 66 |
$result['error'] = $this->error; |
| 67 |
|
| 68 |
return $result; |
| 69 |
} |
| 70 |
|
| 71 |
/** |
| 72 |
* @return mixed |
| 73 |
*/ |
| 74 |
public function getError() |
| 75 |
{ |
| 76 |
return $this->error; |
| 77 |
} |
| 78 |
} |
| 79 |
|