[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/php-ai-client/src/Providers/Http/DTO/ -> Response.php (summary)

(no description)

File Size: 211 lines (6 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

Response:: (13 methods):
  __construct()
  __clone()
  getStatusCode()
  getHeaders()
  getHeader()
  getHeaderAsString()
  getBody()
  hasHeader()
  isSuccessful()
  getData()
  getJsonSchema()
  toArray()
  fromArray()


Class: Response  - X-Ref

Represents an HTTP response.

This class encapsulates HTTP response data that has been converted
from PSR-7 responses by the HTTP transporter.

__construct(int $statusCode, array $headers, ?string $body = null)   X-Ref
Constructor.

param: int $statusCode The HTTP status code.
param: array<string, string|list<string>> $headers The response headers.
param: string|null $body The response body.

__clone()   X-Ref
Creates a deep clone of this response.

Clones the headers collection to ensure the cloned
response is independent of the original.


getStatusCode()   X-Ref
Gets the HTTP status code.

return: int The status code.

getHeaders()   X-Ref
Gets the response headers.

return: array<string, list<string>> The headers.

getHeader(string $name)   X-Ref
Gets a specific header value.

return: list<string>|null The header value(s) or null if not found.
param: string $name The header name (case-insensitive).

getHeaderAsString(string $name)   X-Ref
Gets header values as a comma-separated string.

return: string|null The header values as a comma-separated string or null if not found.
param: string $name The header name (case-insensitive).

getBody()   X-Ref
Gets the response body.

return: string|null The body.

hasHeader(string $name)   X-Ref
Checks if the response has a header.

return: bool True if the header exists, false otherwise.
param: string $name The header name.

isSuccessful()   X-Ref
Checks if the response indicates success.

return: bool True if status code is 2xx, false otherwise.

getData()   X-Ref
Gets the response data as an array.

Attempts to decode the body as JSON. Returns null if the body
is empty or not valid JSON.

return: array<string, mixed>|null The decoded data or null.

getJsonSchema()   X-Ref
{@inheritDoc}


toArray()   X-Ref
{@inheritDoc}

return: ResponseArrayShape

fromArray(array $array)   X-Ref
{@inheritDoc}




Generated : Sat Jun 13 09:38:55 2026 Cross-referenced by PHPXref