original_string: public function sendRequest(ApiKey $apiKey, RestRequest $request)
      {
          $hmac = $this->generateHmac($apiKey->getPrivateKey(), $request->getEndpoint(), array_merge($request->getQueryData(), $request->getPostData()));
  
          $client = new Client([
              'base_uri' => $request->getHost()
          ]);
          
          $args = [
              'auth' => [$apiKey->getPublicKey(), $hmac],
              'headers' => [
                  'Accept' => 'application/json'
              ]
          ];
          
          if ($request->getRequestMethod() === 'POST') {
              $args['form_params'] = $request->getPostData();
          } else {
              $args['query'] = $request->getQueryData();
          }
          
          try {
              $responseRaw = $client->request($request->getRequestMethod(), $request->getEndpoint(), $args);
          } catch (RequestException $e) {
              if (!$e->hasResponse()) {
                  throw new Exception('Cannot send REST request.', 0, $e);
              }
              
              $responseRaw = $e->getResponse();
          }
          
          return $this->prepareResponse($responseRaw, $request);
      }
code: public function sendRequest(ApiKey $apiKey, RestRequest $request)
      {
          $hmac = $this->generateHmac($apiKey->getPrivateKey(), $request->getEndpoint(), array_merge($request->getQueryData(), $request->getPostData()));
  
          $client = new Client([
              'base_uri' => $request->getHost()
          ]);
          
          $args = [
              'auth' => [$apiKey->getPublicKey(), $hmac],
              'headers' => [
                  'Accept' => 'application/json'
              ]
          ];
          
          if ($request->getRequestMethod() === 'POST') {
              $args['form_params'] = $request->getPostData();
          } else {
              $args['query'] = $request->getQueryData();
          }
          
          try {
              $responseRaw = $client->request($request->getRequestMethod(), $request->getEndpoint(), $args);
          } catch (RequestException $e) {
              if (!$e->hasResponse()) {
                  throw new Exception('Cannot send REST request.', 0, $e);
              }
              
              $responseRaw = $e->getResponse();
          }
          
          return $this->prepareResponse($responseRaw, $request);
      }
code_tokens: public function sendRequest ( ApiKey $ apiKey , RestRequest $ request ) { $ hmac = $ this -> generateHmac ( $ apiKey -> getPrivateKey ( ) , $ request -> getEndpoint ( ) , array_merge ( $ request -> getQueryData ( ) , $ request -> getPostData ( ) ) ) ; $ client = new Client ( [ 'base_uri' => $ request -> getHost ( ) ] ) ; $ args = [ 'auth' => [ $ apiKey -> getPublicKey ( ) , $ hmac ] , 'headers' => [ 'Accept' => 'application/json' ] ] ; if ( $ request -> getRequestMethod ( ) === 'POST' ) { $ args [ 'form_params' ] = $ request -> getPostData ( ) ; } else { $ args [ 'query' ] = $ request -> getQueryData ( ) ; } try { $ responseRaw = $ client -> request ( $ request -> getRequestMethod ( ) , $ request -> getEndpoint ( ) , $ args ) ; } catch ( RequestException $ e ) { if ( ! $ e -> hasResponse ( ) ) { throw new Exception ( 'Cannot send REST request.' , 0 , $ e ) ; } $ responseRaw = $ e -> getResponse ( ) ; } return $ this -> prepareResponse ( $ responseRaw , $ request ) ; }
docstring: Sends the RestRequest to the endpoint
  
  @access public
  @param \Zepi\Api\AccessControl\Entity\ApiKey $apiKey
  @param \Zepi\Api\Rest\Entity\Request $request
  @return \Zepi\Api\Rest\Entity\Response
  
  @throws \Zepi\Api\Rest\Exception Cannot send REST request.
docstring_tokens: Sends the RestRequest to the endpoint