コード例 #1
0
 private function createBadRequestResponse(ApiProblem $problem)
 {
     $status = ApiProblemJsonResponse::HTTP_BAD_REQUEST;
     $problem->setStatus($status);
     $response = new ApiProblemJsonResponse($problem);
     return $response;
 }
コード例 #2
0
 /**
  * Creates and return new ApiProblem instance
  *
  * @param  string     $title  title
  * @param  int        $status status code
  * @param  string     $detail description
  * @return ApiProblem
  */
 private function apiProblem($title, $status, $detail = null)
 {
     $problem = new ApiProblem($title, 'http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html');
     if ($detail) {
         $problem->setDetail($detail);
     }
     $problem->setStatus($status);
     return $problem;
 }
コード例 #3
0
 /**
  * @param \Exception $e
  * @return ApiProblem
  */
 protected function createNewApiProblem(\Exception $e)
 {
     $problem = new ApiProblem($e->getMessage());
     $problem->setStatus($e->getCode() ? $e->getCode() : ApiProblemJsonResponse::HTTP_BAD_REQUEST);
     return $problem;
 }