@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | protected static $curlAlias = array( |
| 18 | 18 | 'url' => 'CURLOPT_URL', |
| 19 | 19 | 'uri' => 'CURLOPT_URL', |
| 20 | - 'debug' => 'CURLOPT_VERBOSE',//for debug verbose |
|
| 20 | + 'debug' => 'CURLOPT_VERBOSE', //for debug verbose |
|
| 21 | 21 | 'method' => 'CURLOPT_CUSTOMREQUEST', |
| 22 | 22 | 'data' => 'CURLOPT_POSTFIELDS', // array or string , file begin with '@' |
| 23 | 23 | 'ua' => 'CURLOPT_USERAGENT', |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | $alias = self::optionAlias($field); |
| 84 | 84 | // if (null === ($rawField = constant($alias))) {throw new InvalidArgumentException('field is invalid'); |
| 85 | 85 | // } |
| 86 | - return isset($this->options[$alias])?$this->options[$alias]:false; |
|
| 86 | + return isset($this->options[$alias]) ? $this->options[$alias] : false; |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | |
@@ -173,10 +173,10 @@ discard block |
||
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | if (isset($this->options['data'])) { |
| 176 | - $this->options['data'] = is_array($this->options['data'])?http_build_query($this->options['data']):$this->options['data'];//for better compatibility |
|
| 176 | + $this->options['data'] = is_array($this->options['data']) ? http_build_query($this->options['data']) : $this->options['data']; //for better compatibility |
|
| 177 | 177 | } |
| 178 | 178 | if (isset($this->withURIQuery)) { |
| 179 | - $this->options['url'] .= strpos($this->options['url'], '?') === FALSE?'?':'&'; |
|
| 179 | + $this->options['url'] .= strpos($this->options['url'], '?') === FALSE ? '?' : '&'; |
|
| 180 | 180 | $this->options['url'] .= $this->withURIQuery; |
| 181 | 181 | } |
| 182 | 182 | if (isset($this->options['callback'])) { |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | |
| 220 | 220 | $cURLOptions = self::filterAndRaw($this->options); |
| 221 | 221 | |
| 222 | - curl_setopt_array($this->curlHandle, $cURLOptions); |
|
| 222 | + curl_setopt_array($this->curlHandle, $cURLOptions); |
|
| 223 | 223 | |
| 224 | 224 | return $this; |
| 225 | 225 | } |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | return $alias; |
| 251 | 251 | } |
| 252 | 252 | public function makeResponse($isMultiCurl = false) { |
| 253 | - $body = $isMultiCurl?curl_multi_getcontent($this->curlHandle):curl_exec($this->curlHandle); |
|
| 253 | + $body = $isMultiCurl ? curl_multi_getcontent($this->curlHandle) : curl_exec($this->curlHandle); |
|
| 254 | 254 | $info = curl_getinfo($this->curlHandle); |
| 255 | 255 | $errno = curl_errno($this->curlHandle); |
| 256 | 256 | $error = curl_error($this->curlHandle); |
@@ -264,9 +264,9 @@ discard block |
||
| 264 | 264 | if (is_null(self::$logger)) { |
| 265 | 265 | return; |
| 266 | 266 | } |
| 267 | - if($response->hasErrors()){ |
|
| 268 | - self::$logger->error($response->request->getURI() . "\t" . $response->error, array( |
|
| 269 | - 'response' => print_r($response,1), |
|
| 267 | + if ($response->hasErrors()) { |
|
| 268 | + self::$logger->error($response->request->getURI()."\t".$response->error, array( |
|
| 269 | + 'response' => print_r($response, 1), |
|
| 270 | 270 | )); |
| 271 | 271 | } |
| 272 | 272 | |