PHP Class Zend\Diactoros\Response

Responses are considered immutable; all methods that might change state are implemented such that they retain the internal state of the current message and return a new instance that contains the changed state.
Inheritance: implements Psr\Http\Message\ResponseInterface
Show file Open project: zendframework/zend-diactoros Class Usage Examples

Public Methods

Method Description
__construct ( string | resource | Psr\Http\Message\StreamInterface $body = 'php://memory', integer $status = 200, array $headers = [] )
getReasonPhrase ( )
getStatusCode ( )
withStatus ( $code, $reasonPhrase = '' )

Private Methods

Method Description
assertHeaders ( array $headers ) Ensure header names and values are valid.
setStatusCode ( integer | string $code ) Validate a status code.

Method Details

__construct() public method

public __construct ( string | resource | Psr\Http\Message\StreamInterface $body = 'php://memory', integer $status = 200, array $headers = [] )
$body string | resource | Psr\Http\Message\StreamInterface Stream identifier and/or actual stream resource
$status integer Status code for the response, if any.
$headers array Headers for the response, if any.

getReasonPhrase() public method

public getReasonPhrase ( )

getStatusCode() public method

public getStatusCode ( )

withStatus() public method

public withStatus ( $code, $reasonPhrase = '' )