@@ -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': |
@@ -132,15 +132,15 @@ discard block |
||
| 132 | 132 | case 'POST': |
| 133 | 133 | curl_setopt(/** @scrutinizer ignore-type */ $ch, CURLOPT_POST, true); |
| 134 | 134 | if ($this->json === true) { |
| 135 | - $params = json_encode($params); |
|
| 135 | + $params = json_encode($params); |
|
| 136 | 136 | } |
| 137 | 137 | curl_setopt(/** @scrutinizer ignore-type */ $ch, CURLOPT_POSTFIELDS, $params); |
| 138 | 138 | break; |
| 139 | 139 | case 'GET': |
| 140 | 140 | curl_setopt(/** @scrutinizer ignore-type */ $ch, CURLOPT_HTTPGET, true); |
| 141 | 141 | if (!empty($params)) { |
| 142 | - $url .= '?'.http_build_query($params); |
|
| 143 | - curl_setopt(/** @scrutinizer ignore-type */ $ch, CURLOPT_URL, $url); |
|
| 142 | + $url .= '?'.http_build_query($params); |
|
| 143 | + curl_setopt(/** @scrutinizer ignore-type */ $ch, CURLOPT_URL, $url); |
|
| 144 | 144 | } |
| 145 | 145 | break; |
| 146 | 146 | } |
@@ -154,10 +154,10 @@ discard block |
||
| 154 | 154 | $this->response = curl_exec(/** @scrutinizer ignore-type */ $ch); |
| 155 | 155 | |
| 156 | 156 | if (curl_errno(/** @scrutinizer ignore-type */ $ch)) { |
| 157 | - $this->curlErrno = curl_errno(/** @scrutinizer ignore-type */ $ch); |
|
| 158 | - $this->curlError = curl_error(/** @scrutinizer ignore-type */ $ch); |
|
| 159 | - curl_close(/** @scrutinizer ignore-type */ $ch); |
|
| 160 | - return; |
|
| 157 | + $this->curlErrno = curl_errno(/** @scrutinizer ignore-type */ $ch); |
|
| 158 | + $this->curlError = curl_error(/** @scrutinizer ignore-type */ $ch); |
|
| 159 | + curl_close(/** @scrutinizer ignore-type */ $ch); |
|
| 160 | + return; |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | $this->curlInfo = curl_getinfo(/** @scrutinizer ignore-type */ $ch); |
@@ -167,14 +167,14 @@ discard block |
||
| 167 | 167 | |
| 168 | 168 | private function _createHeaders($headers = null) |
| 169 | 169 | { |
| 170 | - $headers[] = $this->_api_key_var.$this->_api_key; |
|
| 171 | - if ($this->json === true) { |
|
| 172 | - $headers[] = 'Content-Type: application/json'; |
|
| 173 | - } |
|
| 174 | - if ($this->accept === true) { |
|
| 175 | - $headers[] = 'Accept: application/json'; |
|
| 176 | - } |
|
| 177 | - return $headers; |
|
| 170 | + $headers[] = $this->_api_key_var.$this->_api_key; |
|
| 171 | + if ($this->json === true) { |
|
| 172 | + $headers[] = 'Content-Type: application/json'; |
|
| 173 | + } |
|
| 174 | + if ($this->accept === true) { |
|
| 175 | + $headers[] = 'Accept: application/json'; |
|
| 176 | + } |
|
| 177 | + return $headers; |
|
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | private function _parseHeaders($raw_headers) |
@@ -209,12 +209,12 @@ discard block |
||
| 209 | 209 | |
| 210 | 210 | private function _getHeaders() |
| 211 | 211 | { |
| 212 | - return $this->_parseHeaders(substr($this->response, 0, $this->curlInfo['header_size'])); |
|
| 212 | + return $this->_parseHeaders(substr($this->response, 0, $this->curlInfo['header_size'])); |
|
| 213 | 213 | } |
| 214 | 214 | |
| 215 | 215 | private function _getBody() |
| 216 | 216 | { |
| 217 | - return substr($this->response, $this->curlInfo['header_size']); |
|
| 217 | + return substr($this->response, $this->curlInfo['header_size']); |
|
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | public function getResponse() |