original_string: public function performApiRequest($method, \Payrexx\Models\Base $model)
      {
          $params = $model->toArray($method);
          $params['ApiSignature'] =
              base64_encode(hash_hmac('sha256', http_build_query($params, null, '&'), $this->apiSecret, true));
          $params['instance'] = $this->instance;
  
          $id = isset($params['id']) ? $params['id'] : 0;
          $apiUrl = sprintf(self::API_URL_FORMAT, $this->apiBaseDomain, self::VERSION, $params['model'], $id);
  
          $response = $this->communicationHandler->requestApi(
              $apiUrl,
              $params,
              $this->getHttpMethod($method)
          );
  
          $convertedResponse = array();
          if (!isset($response['body']['data']) || !is_array($response['body']['data'])) {
              if (!isset($response['body']['message'])) {
                  throw new \Payrexx\PayrexxException('Payrexx PHP: Configuration is wrong! Check instance name and API secret', $response['info']['http_code']);
              }
              throw new \Payrexx\PayrexxException($response['body']['message'], $response['info']['http_code']);
          }
  
          foreach ($response['body']['data'] as $object) {
              $responseModel = $model->getResponseModel();
              $convertedResponse[] = $responseModel->fromArray($object);
          }
          if (
              strpos($method, 'One') !== false ||
              strpos($method, 'create') !== false
          ) {
              $convertedResponse = current($convertedResponse);
          }
          return $convertedResponse;
      }
code: public function performApiRequest($method, \Payrexx\Models\Base $model)
      {
          $params = $model->toArray($method);
          $params['ApiSignature'] =
              base64_encode(hash_hmac('sha256', http_build_query($params, null, '&'), $this->apiSecret, true));
          $params['instance'] = $this->instance;
  
          $id = isset($params['id']) ? $params['id'] : 0;
          $apiUrl = sprintf(self::API_URL_FORMAT, $this->apiBaseDomain, self::VERSION, $params['model'], $id);
  
          $response = $this->communicationHandler->requestApi(
              $apiUrl,
              $params,
              $this->getHttpMethod($method)
          );
  
          $convertedResponse = array();
          if (!isset($response['body']['data']) || !is_array($response['body']['data'])) {
              if (!isset($response['body']['message'])) {
                  throw new \Payrexx\PayrexxException('Payrexx PHP: Configuration is wrong! Check instance name and API secret', $response['info']['http_code']);
              }
              throw new \Payrexx\PayrexxException($response['body']['message'], $response['info']['http_code']);
          }
  
          foreach ($response['body']['data'] as $object) {
              $responseModel = $model->getResponseModel();
              $convertedResponse[] = $responseModel->fromArray($object);
          }
          if (
              strpos($method, 'One') !== false ||
              strpos($method, 'create') !== false
          ) {
              $convertedResponse = current($convertedResponse);
          }
          return $convertedResponse;
      }
code_tokens: public function performApiRequest ( $ method , \ Payrexx \ Models \ Base $ model ) { $ params = $ model -> toArray ( $ method ) ; $ params [ 'ApiSignature' ] = base64_encode ( hash_hmac ( 'sha256' , http_build_query ( $ params , null , '&' ) , $ this -> apiSecret , true ) ) ; $ params [ 'instance' ] = $ this -> instance ; $ id = isset ( $ params [ 'id' ] ) ? $ params [ 'id' ] : 0 ; $ apiUrl = sprintf ( self :: API_URL_FORMAT , $ this -> apiBaseDomain , self :: VERSION , $ params [ 'model' ] , $ id ) ; $ response = $ this -> communicationHandler -> requestApi ( $ apiUrl , $ params , $ this -> getHttpMethod ( $ method ) ) ; $ convertedResponse = array ( ) ; if ( ! isset ( $ response [ 'body' ] [ 'data' ] ) || ! is_array ( $ response [ 'body' ] [ 'data' ] ) ) { if ( ! isset ( $ response [ 'body' ] [ 'message' ] ) ) { throw new \ Payrexx \ PayrexxException ( 'Payrexx PHP: Configuration is wrong! Check instance name and API secret' , $ response [ 'info' ] [ 'http_code' ] ) ; } throw new \ Payrexx \ PayrexxException ( $ response [ 'body' ] [ 'message' ] , $ response [ 'info' ] [ 'http_code' ] ) ; } foreach ( $ response [ 'body' ] [ 'data' ] as $ object ) { $ responseModel = $ model -> getResponseModel ( ) ; $ convertedResponse [ ] = $ responseModel -> fromArray ( $ object ) ; } if ( strpos ( $ method , 'One' ) !== false || strpos ( $ method , 'create' ) !== false ) { $ convertedResponse = current ( $ convertedResponse ) ; } return $ convertedResponse ; }
docstring: Perform a simple API request by method name and Request model.
  
  @param string                       $method The name of the API method to call
  @param \Payrexx\Models\Base $model  The model which has the same functionality like a filter.
  
  @return \Payrexx\Models\Base[]|\Payrexx\Models\Base An array of models or just one model which
  is the result of the API call
  @throws \Payrexx\PayrexxException An error occurred during the Payrexx Request
docstring_tokens: Perform a simple API request by method name and Request model .