AbstractHttp
in package
implements
HttpInterface
Abstract HTTP class
Tags
Interfaces, Classes and Traits
- HttpInterface
- HTTP interface
Table of Contents
- $body : Body
- Body
- $headers : array<string|int, mixed>
- Headers
- __get() : mixed
- Magic method to get either the headers or body
- addHeader() : AbstractHttp
- Add a header
- addHeaders() : AbstractHttp
- Add all headers
- decodeBodyContent() : Body
- Decode the body
- getBody() : Body
- Get the body
- getBodyContent() : mixed
- Get body content
- getHeader() : 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
- hasBody() : bool
- Has a body
- hasBodyContent() : bool
- Has body content
- hasHeader() : bool
- Has a header
- hasHeaders() : bool
- Determine if there are headers
- removeBody() : AbstractHttp
- Remove the body
- removeHeader() : AbstractHttp
- Remove a header
- removeHeaders() : AbstractHttp
- Remove all headers
- setBody() : AbstractHttp
- Set the body
Properties
$body
Body
protected
Body
$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
Return values
mixed —addHeader()
Add a header
public
addHeader(Header|string $header[, string $value = null ]) : AbstractHttp
Parameters
- $header : Header|string
- $value : string = null
Return values
AbstractHttp —addHeaders()
Add all headers
public
addHeaders(array<string|int, mixed> $headers) : AbstractHttp
Parameters
- $headers : array<string|int, mixed>
Return values
AbstractHttp —decodeBodyContent()
Decode the body
public
decodeBodyContent([string $body = null ]) : Body
Parameters
- $body : string = null
Return values
Body —getBody()
Get the body
public
getBody() : Body
Return values
Body —getBodyContent()
Get body content
public
getBodyContent() : mixed
Return values
mixed —getHeader()
Get a header
public
getHeader(string $name) : mixed
Parameters
- $name : string
Return values
mixed —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() : array<string|int, mixed>
Return values
array<string|int, mixed> —getHeadersAsString()
Get all header values formatted string
public
getHeadersAsString([string $status = null ][, string $eol = "
" ]) : string
Parameters
- $status : string = null
- $eol : string = " "
Return values
string —getHeaderValue()
Get header value
public
getHeaderValue(string $name) : mixed
Parameters
- $name : string
Return values
mixed —hasBody()
Has a body
public
hasBody() : bool
Return values
bool —hasBodyContent()
Has body content
public
hasBodyContent() : bool
Return values
bool —hasHeader()
Has a header
public
hasHeader(string $name) : bool
Parameters
- $name : string
Return values
bool —hasHeaders()
Determine if there are headers
public
hasHeaders() : bool
Return values
bool —removeBody()
Remove the body
public
removeBody() : AbstractHttp
Return values
AbstractHttp —removeHeader()
Remove a header
public
removeHeader(string $name) : AbstractHttp
Parameters
- $name : string
Return values
AbstractHttp —removeHeaders()
Remove all headers
public
removeHeaders() : AbstractHttp
Return values
AbstractHttp —setBody()
Set the body
public
setBody(string|Body $body) : AbstractHttp
Parameters
- $body : string|Body