Documentation

rex_socket_response
in package

Class for rex_socket responses.

Tags
author

gharlan

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
throws
InvalidArgumentException

decompressContent()

public decompressContent(bool $decodeContent) : $this
Parameters
$decodeContent : bool
Return values
$this

getBody()

Returns the entire body.

public getBody() : string
Return values
string

getBufferedBody()

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|string

getContentEncodings()

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|null

getStatusCode()

Returns the HTTP status code, e.g. 200.

public getStatusCode() : int
Return values
int

getStatusMessage()

Returns the HTTP status message, e.g. "OK".

public getStatusMessage() : string
Return values
string

isClientError()

Returns wether the status class is "Client Error".

public isClientError() : bool
Return values
bool

isInformational()

Returns wether the status class is "Informational".

public isInformational() : bool
Return values
bool

isInvalid()

Returns wether the status is invalid.

public isInvalid() : bool
Return values
bool

isOk()

Returns wether the status is "200 OK".

public isOk() : bool
Return values
bool

isRedirection()

Returns wether the status class is "Redirection".

public isRedirection() : bool
Return values
bool

isServerError()

Returns wether the status class is "Server Error".

public isServerError() : bool
Return values
bool

isSuccessful()

Returns wether the status class is "Success".

public isSuccessful() : bool
Return values
bool

writeBodyTo()

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
Return values
bool

        
On this page

Search results