original_string: protected function processResponse(RequestInterface $request, CurlHandle $handle, array $curl)
      {
          // Set the transfer stats on the response
          $handle->updateRequestFromTransfer($request);
          // Check if a cURL exception occurred, and if so, notify things
          $curlException = $this->isCurlException($request, $handle, $curl);
  
          // Always remove completed curl handles.  They can be added back again
          // via events if needed (e.g. ExponentialBackoffPlugin)
          $this->removeHandle($request);
  
          if (!$curlException) {
              $state = $request->setState(RequestInterface::STATE_COMPLETE, array('handle' => $handle));
              // Only remove the request if it wasn't resent as a result of the state change
              if ($state != RequestInterface::STATE_TRANSFER) {
                  $this->remove($request);
              }
          } else {
              // Set the state of the request to an error
              $state = $request->setState(RequestInterface::STATE_ERROR, array('exception' => $curlException));
              // Allow things to ignore the error if possible
              if ($state != RequestInterface::STATE_TRANSFER) {
                  $this->remove($request);
              }
              // The error was not handled, so fail
              if ($state == RequestInterface::STATE_ERROR) {
                  /** @var CurlException $curlException */
                  throw $curlException;
              }
          }
      }
code: protected function processResponse(RequestInterface $request, CurlHandle $handle, array $curl)
      {
          // Set the transfer stats on the response
          $handle->updateRequestFromTransfer($request);
          // Check if a cURL exception occurred, and if so, notify things
          $curlException = $this->isCurlException($request, $handle, $curl);
  
          // Always remove completed curl handles.  They can be added back again
          // via events if needed (e.g. ExponentialBackoffPlugin)
          $this->removeHandle($request);
  
          if (!$curlException) {
              $state = $request->setState(RequestInterface::STATE_COMPLETE, array('handle' => $handle));
              // Only remove the request if it wasn't resent as a result of the state change
              if ($state != RequestInterface::STATE_TRANSFER) {
                  $this->remove($request);
              }
          } else {
              // Set the state of the request to an error
              $state = $request->setState(RequestInterface::STATE_ERROR, array('exception' => $curlException));
              // Allow things to ignore the error if possible
              if ($state != RequestInterface::STATE_TRANSFER) {
                  $this->remove($request);
              }
              // The error was not handled, so fail
              if ($state == RequestInterface::STATE_ERROR) {
                  /** @var CurlException $curlException */
                  throw $curlException;
              }
          }
      }
code_tokens: protected function processResponse ( RequestInterface $ request , CurlHandle $ handle , array $ curl ) { // Set the transfer stats on the response $ handle -> updateRequestFromTransfer ( $ request ) ; // Check if a cURL exception occurred, and if so, notify things $ curlException = $ this -> isCurlException ( $ request , $ handle , $ curl ) ; // Always remove completed curl handles.  They can be added back again // via events if needed (e.g. ExponentialBackoffPlugin) $ this -> removeHandle ( $ request ) ; if ( ! $ curlException ) { $ state = $ request -> setState ( RequestInterface :: STATE_COMPLETE , array ( 'handle' => $ handle ) ) ; // Only remove the request if it wasn't resent as a result of the state change if ( $ state != RequestInterface :: STATE_TRANSFER ) { $ this -> remove ( $ request ) ; } } else { // Set the state of the request to an error $ state = $ request -> setState ( RequestInterface :: STATE_ERROR , array ( 'exception' => $ curlException ) ) ; // Allow things to ignore the error if possible if ( $ state != RequestInterface :: STATE_TRANSFER ) { $ this -> remove ( $ request ) ; } // The error was not handled, so fail if ( $ state == RequestInterface :: STATE_ERROR ) { /** @var CurlException $curlException */ throw $ curlException ; } } }
docstring: Check for errors and fix headers of a request based on a curl response
  
  @param RequestInterface $request Request to process
  @param CurlHandle       $handle  Curl handle object
  @param array            $curl    Array returned from curl_multi_info_read
  
  @throws CurlException on Curl error
docstring_tokens: Check for errors and fix headers of a request based on a curl response