Response extends HttpEntity
An entity which represents the HTTP response
Table of Contents
- $headers : array<string|int, mixed>
- The list of headers
- $code : int
- The HTTP attached to the content
- $content : mixed
- Contains the response data
- __construct() : mixed
- addHeader() : void
- Add a new header
- empty() : Entity
- Create an empty Entity
- getCode() : int
- Function to get the content HTTP code.
- getContent() : mixed
- Return the response content
- getHeaders() : array<string|int, mixed>
- Get all the headers
- setHeader() : void
- Add an header to the response
Properties
$headers
The list of headers
protected
array<string|int, mixed>
$headers
$code
The HTTP attached to the content
private
int
$code
$content
Contains the response data
private
mixed
$content
Methods
__construct()
public
__construct(mixed $content[, Formatter $formatter = null ][, int $code = 200 ]) : mixed
Parameters
- $content : mixed
- $formatter : Formatter = null
- $code : int = 200
Return values
mixed —addHeader()
Add a new header
public
addHeader(Header $header) : void
Parameters
- $header : Header
-
the header to add
Return values
void —empty()
Create an empty Entity
public
static empty() : Entity
Return values
Entity —getCode()
Function to get the content HTTP code.
public
getCode() : int
Return -1 if this code can be ignored
Return values
int —getContent()
Return the response content
public
getContent() : mixed
Return values
mixed —getHeaders()
Get all the headers
public
getHeaders() : array<string|int, mixed>
Return values
array<string|int, mixed> —Array of Headers
setHeader()
Add an header to the response
public
setHeader(string $name, mixed $value) : void
Parameters
- $name : string
-
The name of the header
- $value : mixed
-
The value of the header