Zend\Stratigility\Http\Response::withStatus PHP Method

withStatus() public method

public withStatus ( $code, $reasonPhrase = null )
    public function withStatus($code, $reasonPhrase = null)
    {
        if ($this->complete) {
            throw $this->responseIsAlreadyCompleted(__METHOD__);
        }
        $new = $this->psrResponse->withStatus($code, $reasonPhrase);
        return new self($new);
    }

Usage Example

 public function testErrorResponsePreservesResponseReasonPhraseIfStatusCodeMatchesExceptionCode()
 {
     $this->response = $this->response->withStatus(500, 'It broke!');
     $response = call_user_func($this->final, $this->request, $this->response, new \Exception('foo', 500));
     $this->assertSame($this->response->getReasonPhrase(), $response->getReasonPhrase());
 }
All Usage Examples Of Zend\Stratigility\Http\Response::withStatus