@@ -45,18 +45,18 @@ discard block |
||
| 45 | 45 | { |
| 46 | 46 | if (!function_exists('curl_init')) |
| 47 | 47 | { |
| 48 | - throw new CurlException("cURL is not available. This API wrapper cannot be used."); |
|
| 48 | + throw new CurlException("cURL is not available. This API wrapper cannot be used."); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | if (isset($api_key)) |
| 52 | 52 | { |
| 53 | - $this->setApiKey($api_key); |
|
| 53 | + $this->setApiKey($api_key); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | if ($basic === true) |
| 57 | 57 | { |
| 58 | - $this->_api_key_var = 'Authorization: Basic '; |
|
| 59 | - $this->json = false; |
|
| 58 | + $this->_api_key_var = 'Authorization: Basic '; |
|
| 59 | + $this->json = false; |
|
| 60 | 60 | } |
| 61 | 61 | } |
| 62 | 62 | |
@@ -117,10 +117,10 @@ discard block |
||
| 117 | 117 | curl_setopt(/** @scrutinizer ignore-type */ $ch, CURLOPT_HEADER, true); |
| 118 | 118 | curl_setopt(/** @scrutinizer ignore-type */ $ch, CURLINFO_HEADER_OUT, true); |
| 119 | 119 | if ($this->curlProxy) { |
| 120 | - curl_setopt(/** @scrutinizer ignore-type */ $ch, CURLOPT_PROXY, $this->curlProxy); |
|
| 120 | + curl_setopt(/** @scrutinizer ignore-type */ $ch, CURLOPT_PROXY, $this->curlProxy); |
|
| 121 | 121 | } |
| 122 | 122 | if ($this->_curl_callback) { |
| 123 | - call_user_func($this->_curl_callback, $ch, $params, $headers, $method); |
|
| 123 | + call_user_func($this->_curl_callback, $ch, $params, $headers, $method); |
|
| 124 | 124 | } |
| 125 | 125 | switch (strtoupper($method)) { |
| 126 | 126 | case 'PUT': |
@@ -148,10 +148,10 @@ discard block |
||
| 148 | 148 | $this->response = curl_exec(/** @scrutinizer ignore-type */ $ch); |
| 149 | 149 | |
| 150 | 150 | if (curl_errno(/** @scrutinizer ignore-type */ $ch)) { |
| 151 | - $this->curlErrno = curl_errno(/** @scrutinizer ignore-type */ $ch); |
|
| 152 | - $this->curlError = curl_error(/** @scrutinizer ignore-type */ $ch); |
|
| 153 | - curl_close(/** @scrutinizer ignore-type */ $ch); |
|
| 154 | - return; |
|
| 151 | + $this->curlErrno = curl_errno(/** @scrutinizer ignore-type */ $ch); |
|
| 152 | + $this->curlError = curl_error(/** @scrutinizer ignore-type */ $ch); |
|
| 153 | + curl_close(/** @scrutinizer ignore-type */ $ch); |
|
| 154 | + return; |
|
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | $this->curlInfo = curl_getinfo(/** @scrutinizer ignore-type */ $ch); |
@@ -161,14 +161,14 @@ discard block |
||
| 161 | 161 | |
| 162 | 162 | private function _createHeaders($headers = null) |
| 163 | 163 | { |
| 164 | - $headers[] = $this->_api_key_var.$this->_api_key; |
|
| 165 | - if ($this->json === true) { |
|
| 166 | - $headers[] = 'Content-Type: application/json'; |
|
| 167 | - } |
|
| 168 | - if ($this->accept === true) { |
|
| 169 | - $headers[] = 'Accept: application/json'; |
|
| 170 | - } |
|
| 171 | - return $headers; |
|
| 164 | + $headers[] = $this->_api_key_var.$this->_api_key; |
|
| 165 | + if ($this->json === true) { |
|
| 166 | + $headers[] = 'Content-Type: application/json'; |
|
| 167 | + } |
|
| 168 | + if ($this->accept === true) { |
|
| 169 | + $headers[] = 'Accept: application/json'; |
|
| 170 | + } |
|
| 171 | + return $headers; |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | private function _parseHeaders($raw_headers) |
@@ -203,12 +203,12 @@ discard block |
||
| 203 | 203 | |
| 204 | 204 | private function _getHeaders() |
| 205 | 205 | { |
| 206 | - return $this->_parseHeaders(substr($this->response, 0, $this->curlInfo['header_size'])); |
|
| 206 | + return $this->_parseHeaders(substr($this->response, 0, $this->curlInfo['header_size'])); |
|
| 207 | 207 | } |
| 208 | 208 | |
| 209 | 209 | private function _getBody() |
| 210 | 210 | { |
| 211 | - return substr($this->response, $this->curlInfo['header_size']); |
|
| 211 | + return substr($this->response, $this->curlInfo['header_size']); |
|
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | public function getResponse() |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | public function get($url, $params = null, $headers = null) |
| 225 | 225 | { |
| 226 | 226 | if (!empty($params)) { |
| 227 | - $url .= '?'.http_build_query($params); |
|
| 227 | + $url .= '?'.http_build_query($params); |
|
| 228 | 228 | } |
| 229 | 229 | return $this->_call($url, $params, $headers, $method = "GET"); |
| 230 | 230 | } |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | public function post($url, $params = null, $headers = null) |
| 233 | 233 | { |
| 234 | 234 | if ($this->json === true) { |
| 235 | - $params = json_encode($params); |
|
| 235 | + $params = json_encode($params); |
|
| 236 | 236 | } |
| 237 | 237 | return $this->_call($url, $params, $headers, $method = "POST"); |
| 238 | 238 | } |