Completed
Push — master ( 427234...743fc9 )
by Vermeulen
9s
created
src/class/CallCurl.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
     protected function checkLib()
103 103
     {
104 104
         //Check curl php extension
105
-        if(!function_exists('curl_init')) {
105
+        if (!function_exists('curl_init')) {
106 106
             throw new Exception('Please install or activate php-curl extension for use CallCurl plugin.');
107 107
         }
108 108
     }
@@ -116,15 +116,15 @@  discard block
 block discarded – undo
116 116
      */
117 117
     protected function checkParser(&$parser)
118 118
     {
119
-        if(is_null($parser)) {
119
+        if (is_null($parser)) {
120 120
             $parser = new DefaultParser;
121 121
         }
122 122
 
123
-        if(!is_object($parser)) {
123
+        if (!is_object($parser)) {
124 124
             throw new Exception('Parser should be an object instance.');
125 125
         }
126 126
 
127
-        if(!($parser instanceof ParserInterface)) {
127
+        if (!($parser instanceof ParserInterface)) {
128 128
             throw new Exception('Parser should implement \bultonFr\Parser interface.');
129 129
         }
130 130
     }
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
      */
141 141
     public function setUrl($url)
142 142
     {
143
-        if(!is_string($url)) {
143
+        if (!is_string($url)) {
144 144
             throw new Exception('Url send to CallCurl should be a string variable');
145 145
         }
146 146
 
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
      */
196 196
     public function setHttpMethod($method)
197 197
     {
198
-        if(!is_string($method)) {
198
+        if (!is_string($method)) {
199 199
             throw new Exception('HTTP method send to CallCurl should be a string variable');
200 200
         }
201 201
 
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
      */
217 217
     public function setDebug($debug)
218 218
     {
219
-        if(!is_bool($debug)) {
219
+        if (!is_bool($debug)) {
220 220
             throw new Exception('Debug status send to CallCurl should be a boolean variable');
221 221
         }
222 222
 
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
      */
237 237
     public function setCheckSSL($checkSSL)
238 238
     {
239
-        if(!is_bool($checkSSL)) {
239
+        if (!is_bool($checkSSL)) {
240 240
             throw new Exception('CheckSSL status send to CallCurl should be a boolean variable');
241 241
         }
242 242
 
@@ -314,13 +314,13 @@  discard block
 block discarded – undo
314 314
         $this->curlOptionsAddDatas($options);
315 315
         $this->curlOptionsAddHttpHeaders($options);
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
         }
@@ -330,19 +330,19 @@  discard block
 block discarded – undo
330 330
     
331 331
     protected function curlOptionsAddDatas(&$options)
332 332
     {
333
-        if(empty($this->datas)) {
333
+        if (empty($this->datas)) {
334 334
             return;
335 335
         }
336 336
         
337
-        if($this->httpMethod === 'GET') {
337
+        if ($this->httpMethod === 'GET') {
338 338
             
339
-            if(is_string($this->datas)) {
339
+            if (is_string($this->datas)) {
340 340
                 $datasUrl = urlencode($this->datas);
341 341
             } else {
342 342
                 $datasUrl = http_build_query($this->datas);
343 343
             }
344 344
 
345
-            if(strpos($this->url, '?') !== false) {
345
+            if (strpos($this->url, '?') !== false) {
346 346
                 $datasUrl = '&'.$datasUrl;
347 347
             }
348 348
             else {
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
             return;
354 354
         }
355 355
         
356
-        if($this->httpMethod === 'POST') {
356
+        if ($this->httpMethod === 'POST') {
357 357
             $options[CURLOPT_POST]       = true;
358 358
             $options[CURLOPT_POSTFIELDS] = $this->datas;
359 359
             
Please login to merge, or discard this patch.