Documentation

ResponseBuilder extends ResponseBuilder
in package

Extended response builder.

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.
setResponse()  : void
Replace response with a new instance.
setStatus()  : $this
Set response status from a status string.

Properties

Methods

addHeader()

Add header represented by a string.

public addHeader(string $headerLine) : $this
Parameters
$headerLine : string

response header as a string

Tags
throws
InvalidArgumentException

for invalid header names or values

Return values
$this

setHeadersFromArray()

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

for invalid header values

throws
InvalidArgumentException

for invalid status code arguments

Return values
$this

setHeadersFromString()

Add headers represented by a single string.

public setHeadersFromString(string $headers) : $this
Parameters
$headers : string

response headers as single string

Tags
throws
InvalidArgumentException

if $headers is not a string on object with __toString()

throws
UnexpectedValueException

for invalid header values

Return values
$this

setStatus()

Set response status from a status string.

public setStatus(string $statusLine) : $this
Parameters
$statusLine : string

response status as a string

Tags
throws
InvalidArgumentException

for invalid status line

Return values
$this

        
On this page

Search results