@@ -92,7 +92,7 @@ public function success()
9292 /**
9393 * Get the last error returned by either the network transport, or by the API.
9494 * If something didn't work, this should contain the string describing the problem.
95- * @return array |false describing the error
95+ * @return string |false describing the error
9696 */
9797 public function getLastError ()
9898 {
@@ -241,16 +241,22 @@ private function makeRequest($http_verb, $method, $args = array(), $timeout = se
241241
242242 $ responseContent = curl_exec ($ ch );
243243 $ response ['headers ' ] = curl_getinfo ($ ch );
244- curl_close ($ ch );
245-
246- $ response = $ this ->setResponseState ($ response , $ responseContent );
244+ $ response = $ this ->setResponseState ($ response , $ responseContent , $ ch );
247245 $ formattedResponse = $ this ->formatResponse ($ response );
248246
247+ curl_close ($ ch );
248+
249249 $ this ->determineSuccess ($ response , $ formattedResponse , $ timeout );
250250
251251 return $ formattedResponse ;
252252 }
253253
254+ /**
255+ * @param string $http_verb
256+ * @param string $method
257+ * @param string $url
258+ * @param integer $timeout
259+ */
254260 private function prepareStateForRequest ($ http_verb , $ method , $ url , $ timeout )
255261 {
256262 $ this ->last_error = '' ;
@@ -371,7 +377,7 @@ private function formatResponse($response)
371377 * @param string $responseContent The body of the response from the curl request
372378 * * @return array The modified response
373379 */
374- private function setResponseState ($ response , $ responseContent )
380+ private function setResponseState ($ response , $ responseContent, $ ch )
375381 {
376382 if ($ responseContent === false ) {
377383 $ this ->last_error = curl_error ($ ch );
0 commit comments