rex_socket_response
in package
Class for rex_socket responses.
Tags
Table of Contents
Methods
- __construct() : mixed
- decompressContent() : $this
- getBody() : string
- Returns the entire body.
- getBufferedBody() : false|string
- Returns up to `$length` bytes from the body, or `false` if the end is reached.
- getContentEncodings() : array<int, string>
- Returns an array with all applied content encodings.
- getHeader() : string|null
- Returns the header for the given key, or the entire header if no key is given.
- getStatusCode() : int
- Returns the HTTP status code, e.g. 200.
- getStatusMessage() : string
- Returns the HTTP status message, e.g. "OK".
- isClientError() : bool
- Returns wether the status class is "Client Error".
- isInformational() : bool
- Returns wether the status class is "Informational".
- isInvalid() : bool
- Returns wether the status is invalid.
- isOk() : bool
- Returns wether the status is "200 OK".
- isRedirection() : bool
- Returns wether the status class is "Redirection".
- isServerError() : bool
- Returns wether the status class is "Server Error".
- isSuccessful() : bool
- Returns wether the status class is "Success".
- writeBodyTo() : bool
- Writes the body to the given resource.
- isGzipOrDeflateEncoded() : bool
Methods
__construct()
public
__construct(resource $stream) : mixed
Parameters
- $stream : resource
-
Socket stream
Tags
decompressContent()
public
decompressContent(bool $decodeContent) : $this
Parameters
- $decodeContent : bool
Return values
$thisgetBody()
Returns the entire body.
public
getBody() : string
Return values
stringgetBufferedBody()
Returns up to `$length` bytes from the body, or `false` if the end is reached.
public
getBufferedBody([int $length = 1024 ]) : false|string
Parameters
- $length : int = 1024
-
Max number of bytes
Return values
false|stringgetContentEncodings()
Returns an array with all applied content encodings.
public
getContentEncodings() : array<int, string>
Return values
array<int, string>getHeader()
Returns the header for the given key, or the entire header if no key is given.
public
getHeader([string $key = null ][, string $default = null ]) : string|null
Parameters
- $key : string = null
-
Header key
- $default : string = null
-
Default value (is returned if the header is not set)
Return values
string|nullgetStatusCode()
Returns the HTTP status code, e.g. 200.
public
getStatusCode() : int
Return values
intgetStatusMessage()
Returns the HTTP status message, e.g. "OK".
public
getStatusMessage() : string
Return values
stringisClientError()
Returns wether the status class is "Client Error".
public
isClientError() : bool
Return values
boolisInformational()
Returns wether the status class is "Informational".
public
isInformational() : bool
Return values
boolisInvalid()
Returns wether the status is invalid.
public
isInvalid() : bool
Return values
boolisOk()
Returns wether the status is "200 OK".
public
isOk() : bool
Return values
boolisRedirection()
Returns wether the status class is "Redirection".
public
isRedirection() : bool
Return values
boolisServerError()
Returns wether the status class is "Server Error".
public
isServerError() : bool
Return values
boolisSuccessful()
Returns wether the status class is "Success".
public
isSuccessful() : bool
Return values
boolwriteBodyTo()
Writes the body to the given resource.
public
writeBodyTo(string|resource $resource) : bool
Parameters
- $resource : string|resource
-
File path or file pointer
Return values
bool —true
on success, false
on failure
isGzipOrDeflateEncoded()
protected
isGzipOrDeflateEncoded() : bool