PHP Class Phly\Http\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, use trait MessageTrait
Mostra file Open project: phly/http Class Usage Examples

Public Methods

Method Description
__construct ( $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.
validateStatus ( integer | string $code ) Validate a status code.

Method Details

__construct() public method

public __construct ( $body = 'php://memory', integer $status = 200, array $headers = [] )
$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 = '' )