WordPress\AiClient\Providers\Http\DTO
Response::__construct
Constructor.
Method of the class: Response{}
No Hooks.
Returns
null. Nothing (null).
Usage
$Response = new Response(); $Response->__construct( $statusCode, $headers, ?string $body );
- $statusCode(int) (required)
- The HTTP status code.
- $headers(array) (required)
- .
- ?string $body
- .
Default:null
Changelog
| Since 0.1.0 | Introduced. |
Response::__construct() Response:: construct code WP 7.1.4
public function __construct(int $statusCode, array $headers, ?string $body = null)
{
if ($statusCode < 100 || $statusCode >= 600) {
throw new InvalidArgumentException('Invalid HTTP status code: ' . $statusCode);
}
$this->statusCode = $statusCode;
$this->headers = new HeadersCollection($headers);
$this->body = $body;
}