protected function buildErrorResponse(Response $response, $statusCode, $statusMessage, $expose = false)
    {
        // Normalize for Exceptions from other parts of the app.
        if ($statusCode < 200 || $statusCode > 510) {
            $statusCode = 500;
        }

        $body = new Doozr_Response_Body('php://memory', 'w');

        // Do not expose secret information
        if (false === $expose) {
            $statusMessage = constant('Doozr_Http::REASONPHRASE_'.$statusCode);
        }
        $body->write('<h1>'.$statusMessage.'</h1>');

        return $response
            ->withStatus($statusCode, $statusMessage)
            ->withBody($body);
    }
protected function buildErrorResponse(Response $response, $statusCode, $statusMessage, $expose = false)
    {
        // Normalize for Exceptions from other parts of the app.
        if ($statusCode < 200 || $statusCode > 510) {
            $statusCode = 500;
        }

        $body = new Doozr_Response_Body('php://memory', 'w');

        // Do not expose secret information
        if (false === $expose) {
            $statusMessage = constant('Doozr_Http::REASONPHRASE_'.$statusCode);
        }
        $body->write('<h1>'.$statusMessage.'</h1>');

        return $response
            ->withStatus($statusCode, $statusMessage)
            ->withBody($body);
    }
protected function buildErrorResponse ( Response $ response , $ statusCode , $ statusMessage , $ expose = false ) { // Normalize for Exceptions from other parts of the app. if ( $ statusCode < 200 || $ statusCode > 510 ) { $ statusCode = 500 ; } $ body = new Doozr_Response_Body ( 'php://memory' , 'w' ) ; // Do not expose secret information if ( false === $ expose ) { $ statusMessage = constant ( 'Doozr_Http::REASONPHRASE_' . $ statusCode ) ; } $ body -> write ( '<h1>' . $ statusMessage . '</h1>' ) ; return $ response -> withStatus ( $ statusCode , $ statusMessage ) -> withBody ( $ body ) ; }
Returns a prepared response with error message and HTTP status code set.

@param Response $response      The response instance
@param int      $statusCode    The status code
@param string   $statusMessage The status message
@param bool     $expose        Controls whether the real information will be send or the default HTTP one

@author Benjamin Carl <opensource@clickalicious.de>

@return Response The modified response instance
Returns a prepared response with error message and HTTP status code set .