private function createResponseObject(callable $callable)
    {
        try {
            $response = new JsonResponse($callable());
        } catch (EntityNotFoundException $notFoundException) {
            $response = new JsonResponse(
                $notFoundException->getMessage(),
                404
            );
        } catch (Exception $e) {
            $response = new JsonResponse(
                'API exception. Please contact your webmaster',
                500
            );
        }

        return $response;
    }
private function createResponseObject(callable $callable)
    {
        try {
            $response = new JsonResponse($callable());
        } catch (EntityNotFoundException $notFoundException) {
            $response = new JsonResponse(
                $notFoundException->getMessage(),
                404
            );
        } catch (Exception $e) {
            $response = new JsonResponse(
                'API exception. Please contact your webmaster',
                500
            );
        }

        return $response;
    }
private function createResponseObject ( callable $ callable ) { try { $ response = new JsonResponse ( $ callable ( ) ) ; } catch ( EntityNotFoundException $ notFoundException ) { $ response = new JsonResponse ( $ notFoundException -> getMessage ( ) , 404 ) ; } catch ( Exception $ e ) { $ response = new JsonResponse ( 'API exception. Please contact your webmaster' , 500 ) ; } return $ response ; }
Create new response.

@param callable $callable Callable

@return Response Response object
Create new response .