/**
  * Requests the data for a single requests
  *
  * @param bool $getCurlObject whether to return the curl object instead of the response
  *
  * @return string|curl XML representation of a response or curl object.
  */
 protected function singleRequest($getCurlObject)
 {
     if ($this->credentials instanceof SimpleCredentials) {
         $this->curl->setopt(CURLOPT_USERPWD, $this->credentials->getUserID() . ':' . $this->credentials->getPassword());
         $curl = $this->curl;
     } else {
         // we seem to be unable to remove the Authorization header
         // setting to null produces a bogus Authorization: Basic Og==
         $curl = new curl();
     }
     $headers = array('Depth: ' . $this->depth, 'Content-Type: ' . $this->contentType, 'User-Agent: ' . self::USER_AGENT);
     $headers = array_merge($headers, $this->additionalHeaders);
     if ($this->lockToken) {
         $headers[] = 'Lock-Token: <' . $this->lockToken . '>';
     }
     foreach ($this->curlOptions as $option => $optionValue) {
         $curl->setopt($option, $optionValue);
     }
     $curl->setopt(CURLOPT_RETURNTRANSFER, true);
     $curl->setopt(CURLOPT_CUSTOMREQUEST, $this->method);
     $curl->setopt(CURLOPT_URL, reset($this->uri));
     $curl->setopt(CURLOPT_HTTPHEADER, $headers);
     $curl->setopt(CURLOPT_POSTFIELDS, $this->body);
     if ($getCurlObject) {
         $curl->parseResponseHeaders();
     }
     $response = $curl->exec();
     $curl->setResponse($response);
     $httpCode = $curl->getinfo(CURLINFO_HTTP_CODE);
     if ($httpCode >= 200 && $httpCode < 300) {
         if ($getCurlObject) {
             return $curl;
         }
         return $response;
     }
     $this->handleError($curl, $response, $httpCode);
 }