public function send(Request $request) {
        $method   = strtolower($request->getMethod());
        $response = $method === HttpMethods::GET || $method === HttpMethods::DELETE ? $this->restClient->$method($request->getUrlAndQuery(), $request->getCurlOptions()) : $this->restClient->$method($request->getUrlAndQuery(), $request->getPayload(), $request->getCurlOptions());

        try {
            return $request->isExpectedStatusCode($response->getStatusCode()) ? $response : Exceptions::RequestFailedException($request, $response->getStatusCode(), $response->getContent());
        } catch (DBALException\DriverException $e) {
            $responseExceptionFactory = new ResponseExceptionFactory();
            throw $responseExceptionFactory->createDbalException($response, $e);
        }
    }
public function send(Request $request) {
        $method   = strtolower($request->getMethod());
        $response = $method === HttpMethods::GET || $method === HttpMethods::DELETE ? $this->restClient->$method($request->getUrlAndQuery(), $request->getCurlOptions()) : $this->restClient->$method($request->getUrlAndQuery(), $request->getPayload(), $request->getCurlOptions());

        try {
            return $request->isExpectedStatusCode($response->getStatusCode()) ? $response : Exceptions::RequestFailedException($request, $response->getStatusCode(), $response->getContent());
        } catch (DBALException\DriverException $e) {
            $responseExceptionFactory = new ResponseExceptionFactory();
            throw $responseExceptionFactory->createDbalException($response, $e);
        }
    }
public function send ( Request $ request ) { $ method = strtolower ( $ request -> getMethod ( ) ) ; $ response = $ method === HttpMethods :: GET || $ method === HttpMethods :: DELETE ? $ this -> restClient -> $ method ( $ request -> getUrlAndQuery ( ) , $ request -> getCurlOptions ( ) ) : $ this -> restClient -> $ method ( $ request -> getUrlAndQuery ( ) , $ request -> getPayload ( ) , $ request -> getCurlOptions ( ) ) ; try { return $ request -> isExpectedStatusCode ( $ response -> getStatusCode ( ) ) ? $ response : Exceptions :: RequestFailedException ( $ request , $ response -> getStatusCode ( ) , $ response -> getContent ( ) ) ; } catch ( DBALException \ DriverException $ e ) { $ responseExceptionFactory = new ResponseExceptionFactory ( ) ; throw $ responseExceptionFactory -> createDbalException ( $ response , $ e ) ; } }
sends the request

@param  Request $request
@return Response
@throws RequestFailedException

@SuppressWarnings("PHPMD.StaticAccess")
sends the request