Index Documentation

HttpResponse extends HttpMessage
in package

Represents a HTTP response message.

Table of Contents

Methods

__construct()  : mixed
getContent()  : IHttpContent|null
Retrieves message body contents, if present.
getHeader()  : HttpHeader
Retrieves a header by name.
getHeaderFirstLine()  : string
Gets the first line of a header.
getHeaderLine()  : string
Gets the contents of a header as a string.
getHeaderLines()  : array<string|int, string>
Gets lines of a header.
getHeaders()  : array<string|int, HttpHeader>
Retrieves the collection of headers for this HTTP message.
getHttpVersion()  : string
Retrieves the HTTP version of this message.
getStatusCode()  : int
Retrieves the HTTP response message status code.
getStatusText()  : string
Retrieves the HTTP response message status text.
hasContent()  : bool
Checks whether this HTTP message has body contents.
hasHeader()  : bool
Checks if a header is present.
isBencodedContent()  : bool
Checks if the body content is BencodedContent.
isFormContent()  : bool
Checks if the body content is FormContent.
isJsonContent()  : bool
Checks if the body content is JsonContent.
isStreamContent()  : bool
Checks if the body content is StreamContent.
isStringContent()  : bool
Checks if the body content is StringContent.

Methods

__construct()

public __construct(string $version, int $statusCode, string $statusText, HttpHeaders $headers, IHttpContent|null $content) : mixed
Parameters
$version : string

HTTP message version.

$statusCode : int

HTTP response status code.

$statusText : string

HTTP response status text.

$headers : HttpHeaders

HTTP message headers.

$content : IHttpContent|null

Body contents.

getHeader()

Retrieves a header by name.

public getHeader(string $name) : HttpHeader
Parameters
$name : string

Name of the header.

Tags
throws
RuntimeException

If no header with $name exists.

Return values
HttpHeader

Instance of the requested header.

getHeaderFirstLine()

Gets the first line of a header.

public getHeaderFirstLine(string $name) : string
Parameters
$name : string

Name of the header.

Return values
string

First line of the header.

getHeaderLine()

Gets the contents of a header as a string.

public getHeaderLine(string $name) : string
Parameters
$name : string

Name of the header.

Return values
string

Contents of the header.

getHeaderLines()

Gets lines of a header.

public getHeaderLines(string $name) : array<string|int, string>
Parameters
$name : string

Name of the header.

Return values
array<string|int, string>

Header lines.

getHeaders()

Retrieves the collection of headers for this HTTP message.

public getHeaders() : array<string|int, HttpHeader>
Return values
array<string|int, HttpHeader>

HTTP headers.

getHttpVersion()

Retrieves the HTTP version of this message.

public getHttpVersion() : string
Return values
string

HTTP version.

getStatusCode()

Retrieves the HTTP response message status code.

public getStatusCode() : int
Return values
int

HTTP status code.

getStatusText()

Retrieves the HTTP response message status text.

public getStatusText() : string
Return values
string

HTTP status text.

hasContent()

Checks whether this HTTP message has body contents.

public hasContent() : bool
Return values
bool

true if it has body contents.

hasHeader()

Checks if a header is present.

public hasHeader(string $name) : bool
Parameters
$name : string

Name of the header.

Return values
bool

true if the header is present.

isBencodedContent()

Checks if the body content is BencodedContent.

public isBencodedContent() : bool
Return values
bool

true if it is BencodedContent.

isFormContent()

Checks if the body content is FormContent.

public isFormContent() : bool
Return values
bool

true if it is FormContent.

isJsonContent()

Checks if the body content is JsonContent.

public isJsonContent() : bool
Return values
bool

true if it is JsonContent.

isStreamContent()

Checks if the body content is StreamContent.

public isStreamContent() : bool
Return values
bool

true if it is StreamContent.

isStringContent()

Checks if the body content is StringContent.

public isStringContent() : bool
Return values
bool

true if it is StringContent.


        
On this page

Search results