$params */ public function __construct(private array $params = []) { } public function get_param(string $key): mixed { return $this->params[$key] ?? null; } public function set_param(string $key, mixed $value): void { $this->params[$key] = $value; } public function get_body(): string { return (string) ($this->params['__body'] ?? ''); } public function get_header(string $key): string { return (string) ($this->params[$key] ?? ''); } } } // Minimal WP_REST_Response stub exposing the data and status. if (! class_exists('WP_REST_Response')) { class WP_REST_Response { public function __construct(public mixed $data = null, public int $status = 200) { } public function get_data(): mixed { return $this->data; } public function get_status(): int { return $this->status; } } } // Minimal WP_Error stub for code under test that returns error objects. if (! class_exists('WP_Error')) { class WP_Error { /** @var array> */ public array $errors = []; /** @var array */ public array $error_data = []; public function __construct(string $code = '', string $message = '', mixed $data = '') { if ('' !== $code) { $this->errors[$code][] = $message; if ('' !== $data) { $this->error_data[$code] = $data; } } } public function get_error_code(): string { return (string) (array_key_first($this->errors) ?? ''); } public function get_error_message(): string { $code = $this->get_error_code(); return '' !== $code ? ($this->errors[$code][0] ?? '') : ''; } } }