class Response extends AbstractMessage

Class Response

Methods

string|array|null
getHeader(string $name, string|boolean $glue = "\r\n")

Returns the value of a header.

array
getHeaderAttributes(string $name)

Returns a header's attributes.

string|null
getHeaderAttribute(string $header, string $attribute)

Returns the value of a particular header attribute.

toDomDocument()

Returns the current message as a DOMDocument.

setHeaders(array $headers)

Sets all headers on the current message.

addHeader(string $header)

Adds a header to this message.

addHeaders(array $headers)

Adds a set of headers to this message.

array
getHeaders()

Returns an array of header lines.

setContent(string $content)

Sets the content of the message.

string
getContent()

Returns the content of the message.

string
__toString()

Returns the message document.

flattenHeaders(array $headers)

No description

float
getProtocolVersion()

Returns the protocol version of the current response.

integer
getStatusCode()

Returns the status code of the current response.

string
getReasonPhrase()

Returns the reason phrase for the current response.

Boolean
isInvalid()

Is response invalid?

Boolean
isInformational()

Is response informative?

Boolean
isSuccessful()

Is response successful?

Boolean
isRedirection()

Is the response a redirect?

Boolean
isClientError()

Is there a client error?

Boolean
isServerError()

Was there a server side error?

Boolean
isOk()

Is the response OK?

Boolean
isForbidden()

Is the reponse forbidden?

Boolean
isNotFound()

Is the response a not found error?

Boolean
isEmpty()

Is the response empty?

Details

in AbstractMessage at line 22
string|array|null getHeader(string $name, string|boolean $glue = "\r\n")

Returns the value of a header.

Parameters

string $name A header name
string|boolean $glue Glue for implode, or false to return an array

Return Value

string|array|null The header value(s)

in AbstractMessage at line 47
array getHeaderAttributes(string $name)

Returns a header's attributes.

Parameters

string $name A header name

Return Value

array An associative array of attributes

in AbstractMessage at line 74
string|null getHeaderAttribute(string $header, string $attribute)

Returns the value of a particular header attribute.

Parameters

string $header A header name
string $attribute An attribute name

Return Value

string|null The value of the attribute or null if it isn't set

in AbstractMessage at line 88
DOMDocument toDomDocument()

Returns the current message as a DOMDocument.

Return Value

DOMDocument

at line 57
setHeaders(array $headers)

Sets all headers on the current message.

Headers can be complete ["Header: value"] pairs or an associative array ["Header" => "value"]

Parameters

array $headers An array of header lines

at line 64
addHeader(string $header)

Adds a header to this message.

Parameters

string $header A header line

at line 71
addHeaders(array $headers)

Adds a set of headers to this message.

Headers can be complete ["Header: value"] pairs or an associative array ["Header" => "value"]

Parameters

array $headers Headers

in AbstractMessage at line 119
array getHeaders()

Returns an array of header lines.

Return Value

array An array of header lines (integer indexes, e.g. ["Header: value"])

in AbstractMessage at line 124
setContent(string $content)

Sets the content of the message.

Parameters

string $content The message content

in AbstractMessage at line 129
string getContent()

Returns the content of the message.

Return Value

string The message content

in AbstractMessage at line 134
string __toString()

Returns the message document.

Return Value

string The message

in AbstractMessage at line 145
protected flattenHeaders(array $headers)

Parameters

array $headers

at line 20
float getProtocolVersion()

Returns the protocol version of the current response.

Return Value

float

at line 34
integer getStatusCode()

Returns the status code of the current response.

Return Value

integer

at line 48
string getReasonPhrase()

Returns the reason phrase for the current response.

Return Value

string

at line 83
Boolean isInvalid()

Is response invalid?

Return Value

Boolean

at line 93
Boolean isInformational()

Is response informative?

Return Value

Boolean

at line 103
Boolean isSuccessful()

Is response successful?

Return Value

Boolean

at line 113
Boolean isRedirection()

Is the response a redirect?

Return Value

Boolean

at line 123
Boolean isClientError()

Is there a client error?

Return Value

Boolean

at line 133
Boolean isServerError()

Was there a server side error?

Return Value

Boolean

at line 143
Boolean isOk()

Is the response OK?

Return Value

Boolean

at line 153
Boolean isForbidden()

Is the reponse forbidden?

Return Value

Boolean

at line 163
Boolean isNotFound()

Is the response a not found error?

Return Value

Boolean

at line 173
Boolean isEmpty()

Is the response empty?

Return Value

Boolean