AbstractRequestResponse
in package
implements
RequestResponseInterface
AbstractYes
Abstract HTTP request/response class
Tags
Table of Contents
Interfaces
- RequestResponseInterface
- HTTP request/response interface
Properties
Methods
- __get() : mixed
- Magic method to get either the headers or body
- addHeader() : AbstractRequestResponse
- Add a header
- addHeaders() : AbstractRequestResponse
- Add all headers
- decodeBodyContent() : Body
- Decode the body
- getBody() : Body
- Get the body
- getBodyContent() : mixed
- Get body content
- getBodyContentLength() : int
- Get body content length
- getHeader() : mixed
- Get a header
- getHeaderAsString() : mixed
- Get a header
- getHeaders() : array<string|int, mixed>
- Get all headers
- getHeadersAsArray() : array<string|int, mixed>
- Get all header values as associative array
- getHeadersAsString() : string
- Get all header values formatted string
- getHeaderValue() : mixed
- Get header value
- getHeaderValueAsString() : string|null
- Get header value as string
- hasBody() : bool
- Has a body
- hasBodyContent() : bool
- Has body content
- hasHeader() : bool
- Has a header
- hasHeaders() : bool
- Determine if there are headers
- removeBody() : AbstractRequestResponse
- Remove the body
- removeHeader() : AbstractRequestResponse
- Remove a header
- removeHeaders() : AbstractRequestResponse
- Remove all headers
- setBody() : AbstractRequestResponse
- Set the body
- setHeaders() : AbstractRequestResponse
- Set all headers (clear out any existing headers)
Properties
$body
Body
protected
Body|null
$body
= null
$headers
Headers
protected
array<string|int, mixed>
$headers
= []
Methods
__get()
Magic method to get either the headers or body
public
__get(string $name) : mixed
Parameters
- $name : string
addHeader()
Add a header
public
addHeader(Header|string|int $header[, string|null $value = null ]) : AbstractRequestResponse
Parameters
- $header : Header|string|int
- $value : string|null = null
Return values
AbstractRequestResponseaddHeaders()
Add all headers
public
addHeaders(array<string|int, mixed> $headers) : AbstractRequestResponse
Parameters
- $headers : array<string|int, mixed>
Return values
AbstractRequestResponsedecodeBodyContent()
Decode the body
public
decodeBodyContent([string|null $body = null ]) : Body
Parameters
- $body : string|null = null
Return values
BodygetBody()
Get the body
public
getBody() : Body
Return values
BodygetBodyContent()
Get body content
public
getBodyContent() : mixed
getBodyContentLength()
Get body content length
public
getBodyContentLength([bool $mb = false ]) : int
Parameters
- $mb : bool = false
Return values
intgetHeader()
Get a header
public
getHeader(string $name) : mixed
Parameters
- $name : string
getHeaderAsString()
Get a header
public
getHeaderAsString(string $name) : mixed
Parameters
- $name : string
getHeaders()
Get all headers
public
getHeaders() : array<string|int, mixed>
Return values
array<string|int, mixed>getHeadersAsArray()
Get all header values as associative array
public
getHeadersAsArray([bool $asStrings = true ]) : array<string|int, mixed>
Parameters
- $asStrings : bool = true
Return values
array<string|int, mixed>getHeadersAsString()
Get all header values formatted string
public
getHeadersAsString([mixed $status = null ][, string $eol = "
" ]) : string
Parameters
- $status : mixed = null
- $eol : string = " "
Return values
stringgetHeaderValue()
Get header value
public
getHeaderValue(string $name[, int $i = 0 ]) : mixed
Parameters
- $name : string
- $i : int = 0
getHeaderValueAsString()
Get header value as string
public
getHeaderValueAsString(string $name[, int $i = 0 ]) : string|null
Parameters
- $name : string
- $i : int = 0
Return values
string|nullhasBody()
Has a body
public
hasBody() : bool
Return values
boolhasBodyContent()
Has body content
public
hasBodyContent() : bool
Return values
boolhasHeader()
Has a header
public
hasHeader(string $name) : bool
Parameters
- $name : string
Return values
boolhasHeaders()
Determine if there are headers
public
hasHeaders() : bool
Return values
boolremoveBody()
Remove the body
public
removeBody() : AbstractRequestResponse
Return values
AbstractRequestResponseremoveHeader()
Remove a header
public
removeHeader(string $name) : AbstractRequestResponse
Parameters
- $name : string
Return values
AbstractRequestResponseremoveHeaders()
Remove all headers
public
removeHeaders() : AbstractRequestResponse
Return values
AbstractRequestResponsesetBody()
Set the body
public
setBody(string|Body $body) : AbstractRequestResponse
Parameters
- $body : string|Body
Return values
AbstractRequestResponsesetHeaders()
Set all headers (clear out any existing headers)
public
setHeaders(array<string|int, mixed> $headers) : AbstractRequestResponse
Parameters
- $headers : array<string|int, mixed>