protected function jsonErrorResponse($errorMessage, $statusCode = 400, array $httpHeaders = array())
    {
        $statusTexts = \Symfony\Component\HttpFoundation\Response::$statusTexts;

        return $this->jsonResponse(array(
            'error' => (string) $errorMessage,
        ), array(
            'status' => array(
                'code'    => (int) $statusCode,
                'message' => $statusTexts[$statusCode],
            ),
        ), $httpHeaders);
    }
protected function jsonErrorResponse($errorMessage, $statusCode = 400, array $httpHeaders = array())
    {
        $statusTexts = \Symfony\Component\HttpFoundation\Response::$statusTexts;

        return $this->jsonResponse(array(
            'error' => (string) $errorMessage,
        ), array(
            'status' => array(
                'code'    => (int) $statusCode,
                'message' => $statusTexts[$statusCode],
            ),
        ), $httpHeaders);
    }
protected function jsonErrorResponse ( $ errorMessage , $ statusCode = 400 , array $ httpHeaders = array ( ) ) { $ statusTexts = \ Symfony \ Component \ HttpFoundation \ Response :: $ statusTexts ; return $ this -> jsonResponse ( array ( 'error' => ( string ) $ errorMessage , ) , array ( 'status' => array ( 'code' => ( int ) $ statusCode , 'message' => $ statusTexts [ $ statusCode ] , ) , ) , $ httpHeaders ) ; }
Format a json error Response.

@param string $errorMessage The error message to send
@param int    $statusCode   The HTTP status code
@param array  $httpHeaders  Http headers to insert into the Response

@return Response
Format a json error Response .