@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | protected function checkLib() |
| 98 | 98 | { |
| 99 | 99 | //Check curl php extension |
| 100 | - if(!function_exists('curl_init')) { |
|
| 100 | + if (!function_exists('curl_init')) { |
|
| 101 | 101 | throw new Exception('Please install or activate php-curl extension for use WPCurl plugin.'); |
| 102 | 102 | } |
| 103 | 103 | } |
@@ -111,15 +111,15 @@ discard block |
||
| 111 | 111 | */ |
| 112 | 112 | protected function checkParser(&$parser) |
| 113 | 113 | { |
| 114 | - if(is_null($parser)) { |
|
| 114 | + if (is_null($parser)) { |
|
| 115 | 115 | $parser = new DefaultParser; |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | - if(!is_object($parser)) { |
|
| 118 | + if (!is_object($parser)) { |
|
| 119 | 119 | throw new Exception('Parser should be an object instance.'); |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | - if(!($parser instanceof ParserInterface)) { |
|
| 122 | + if (!($parser instanceof ParserInterface)) { |
|
| 123 | 123 | throw new Exception('Parser should implement \bultonFr\Parser interface.'); |
| 124 | 124 | } |
| 125 | 125 | } |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | */ |
| 136 | 136 | public function setUrl($url) |
| 137 | 137 | { |
| 138 | - if(!is_string($url)) { |
|
| 138 | + if (!is_string($url)) { |
|
| 139 | 139 | throw new Exception('Url send to WPCurl should be a string variable'); |
| 140 | 140 | } |
| 141 | 141 | |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | */ |
| 191 | 191 | public function setHttpMethod($method) |
| 192 | 192 | { |
| 193 | - if(!is_string($method)) { |
|
| 193 | + if (!is_string($method)) { |
|
| 194 | 194 | throw new Exception('HTTP method send to WPCurl should be a string variable'); |
| 195 | 195 | } |
| 196 | 196 | |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | */ |
| 212 | 212 | public function setDebug($debug) |
| 213 | 213 | { |
| 214 | - if(!is_bool($debug)) { |
|
| 214 | + if (!is_bool($debug)) { |
|
| 215 | 215 | throw new Exception('Debug status send to WPCurl should be a boolean variable'); |
| 216 | 216 | } |
| 217 | 217 | |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | */ |
| 232 | 232 | public function setCheckSSL($checkSSL) |
| 233 | 233 | { |
| 234 | - if(!is_bool($checkSSL)) { |
|
| 234 | + if (!is_bool($checkSSL)) { |
|
| 235 | 235 | throw new Exception('CheckSSL status send to WPCurl should be a boolean variable'); |
| 236 | 236 | } |
| 237 | 237 | |
@@ -296,10 +296,10 @@ discard block |
||
| 296 | 296 | CURLOPT_RETURNTRANSFER => true |
| 297 | 297 | ]; |
| 298 | 298 | |
| 299 | - if($this->httpMethod === 'GET') { |
|
| 299 | + if ($this->httpMethod === 'GET') { |
|
| 300 | 300 | $datasUrl = urlencode($this->datas); |
| 301 | 301 | |
| 302 | - if(strpos($this->url, '?') !== false) { |
|
| 302 | + if (strpos($this->url, '?') !== false) { |
|
| 303 | 303 | $datasUrl = '&'.$datasUrl; |
| 304 | 304 | } |
| 305 | 305 | else { |
@@ -308,19 +308,19 @@ discard block |
||
| 308 | 308 | |
| 309 | 309 | $options[CURLOPT_URL] .= $datasUrl; |
| 310 | 310 | } |
| 311 | - elseif($this->httpMethod === 'POST') { |
|
| 311 | + elseif ($this->httpMethod === 'POST') { |
|
| 312 | 312 | $options[CURLOPT_POST] = true; |
| 313 | 313 | $options[CURLOPT_POSTFIELDS] = $this->datas; |
| 314 | 314 | } |
| 315 | 315 | //@TODO : Other http status |
| 316 | 316 | |
| 317 | - if($this->debug === true) { |
|
| 317 | + if ($this->debug === true) { |
|
| 318 | 318 | $options[CURLOPT_HEADER] = true; |
| 319 | 319 | $options[CURLOPT_VERBOSE] = true; |
| 320 | 320 | $options[CURLINFO_HEADER_OUT] = true; |
| 321 | 321 | } |
| 322 | 322 | |
| 323 | - if($this->checkSSL === false) { |
|
| 323 | + if ($this->checkSSL === false) { |
|
| 324 | 324 | $options[CURLOPT_SSL_VERIFYHOST] = false; |
| 325 | 325 | $options[CURLOPT_SSL_VERIFYPEER] = false; |
| 326 | 326 | } |
@@ -301,14 +301,12 @@ |
||
| 301 | 301 | |
| 302 | 302 | if(strpos($this->url, '?') !== false) { |
| 303 | 303 | $datasUrl = '&'.$datasUrl; |
| 304 | - } |
|
| 305 | - else { |
|
| 304 | + } else { |
|
| 306 | 305 | $datasUrl = '?'.$datasUrl; |
| 307 | 306 | } |
| 308 | 307 | |
| 309 | 308 | $options[CURLOPT_URL] .= $datasUrl; |
| 310 | - } |
|
| 311 | - elseif($this->httpMethod === 'POST') { |
|
| 309 | + } elseif($this->httpMethod === 'POST') { |
|
| 312 | 310 | $options[CURLOPT_POST] = true; |
| 313 | 311 | $options[CURLOPT_POSTFIELDS] = $this->datas; |
| 314 | 312 | } |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | { |
| 29 | 29 | $callReturn = json_decode($callReturn); |
| 30 | 30 | |
| 31 | - if($callReturn === null) { |
|
| 31 | + if ($callReturn === null) { |
|
| 32 | 32 | throw new Exception(json_last_error_msg()); |
| 33 | 33 | } |
| 34 | 34 | } |