ResponseBuilder
in package
Fills response object with values.
Table of Contents
Properties
- $response : ResponseInterface
- The response to be built.
Methods
- __construct() : mixed
- Create builder for the given response.
- addHeader() : $this
- Add header represented by a string.
- getResponse() : ResponseInterface
- Return response.
- setHeadersFromArray() : $this
- Add headers represented by an array of header lines.
- setHeadersFromString() : $this
- Add headers represented by a single string.
- setStatus() : $this
- Set response status from a status string.
Properties
$response
The response to be built.
protected
ResponseInterface
$response
Methods
__construct()
Create builder for the given response.
public
__construct(ResponseInterface $response) : mixed
Parameters
- $response : ResponseInterface
addHeader()
Add header represented by a string.
public
addHeader(string $headerLine) : $this
Parameters
- $headerLine : string
-
response header as a string
Tags
Return values
$thisgetResponse()
Return response.
public
getResponse() : ResponseInterface
Return values
ResponseInterfacesetHeadersFromArray()
Add headers represented by an array of header lines.
public
setHeadersFromArray(array<string|int, string> $headers) : $this
Parameters
- $headers : array<string|int, string>
-
response headers as array of header lines
Tags
Return values
$thissetHeadersFromString()
Add headers represented by a single string.
public
setHeadersFromString(string $headers) : $this
Parameters
- $headers : string
-
response headers as single string
Tags
Return values
$thissetStatus()
Set response status from a status string.
public
setStatus(string $statusLine) : $this
Parameters
- $statusLine : string
-
response status as a string