@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | protected $isJson = true; |
| 59 | 59 | |
| 60 | 60 | private function closeConnection() { |
| 61 | - if(null !== $this->con) { |
|
| 61 | + if (null !== $this->con) { |
|
| 62 | 62 | curl_close($this->con); |
| 63 | 63 | } |
| 64 | 64 | } |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | $this->url = NULL; |
| 239 | 239 | $this->params = array(); |
| 240 | 240 | $this->headers = array(); |
| 241 | - Logger::log("Context service for " . get_called_class() . " cleared!"); |
|
| 241 | + Logger::log("Context service for ".get_called_class()." cleared!"); |
|
| 242 | 242 | $this->closeConnection(); |
| 243 | 243 | } |
| 244 | 244 | |
@@ -285,8 +285,8 @@ discard block |
||
| 285 | 285 | |
| 286 | 286 | protected function applyHeaders() { |
| 287 | 287 | $headers = []; |
| 288 | - foreach($this->headers as $key => $value) { |
|
| 289 | - $headers[] = $key . ': ' . $value; |
|
| 288 | + foreach ($this->headers as $key => $value) { |
|
| 289 | + $headers[] = $key.': '.$value; |
|
| 290 | 290 | } |
| 291 | 291 | curl_setopt($this->con, CURLOPT_HTTPHEADER, $headers); |
| 292 | 292 | } |
@@ -300,9 +300,9 @@ discard block |
||
| 300 | 300 | break; |
| 301 | 301 | case 'POST': |
| 302 | 302 | $this->addOption(CURLOPT_CUSTOMREQUEST, "POST"); |
| 303 | - if($this->getIsJson()) { |
|
| 303 | + if ($this->getIsJson()) { |
|
| 304 | 304 | $this->addOption(CURLOPT_POSTFIELDS, json_encode($this->params)); |
| 305 | - } else { |
|
| 305 | + }else { |
|
| 306 | 306 | $this->addOption(CURLOPT_POSTFIELDS, http_build_query($this->params)); |
| 307 | 307 | } |
| 308 | 308 | break; |
@@ -312,17 +312,17 @@ discard block |
||
| 312 | 312 | case 'PUT': |
| 313 | 313 | $this->addOption(CURLOPT_CUSTOMREQUEST, "PUT"); |
| 314 | 314 | |
| 315 | - if($this->getIsJson()) { |
|
| 315 | + if ($this->getIsJson()) { |
|
| 316 | 316 | $this->addOption(CURLOPT_POSTFIELDS, json_encode($this->params)); |
| 317 | - } else { |
|
| 317 | + }else { |
|
| 318 | 318 | $this->addOption(CURLOPT_POSTFIELDS, http_build_query($this->params)); |
| 319 | 319 | } |
| 320 | 320 | break; |
| 321 | 321 | case 'PATCH': |
| 322 | 322 | $this->addOption(CURLOPT_CUSTOMREQUEST, "PATCH"); |
| 323 | - if($this->getIsJson()) { |
|
| 323 | + if ($this->getIsJson()) { |
|
| 324 | 324 | $this->addOption(CURLOPT_POSTFIELDS, json_encode($this->params)); |
| 325 | - } else { |
|
| 325 | + }else { |
|
| 326 | 326 | $this->addOption(CURLOPT_POSTFIELDS, http_build_query($this->params)); |
| 327 | 327 | } |
| 328 | 328 | break; |
@@ -339,7 +339,7 @@ discard block |
||
| 339 | 339 | $this->applyHeaders(); |
| 340 | 340 | $result = curl_exec($this->con); |
| 341 | 341 | $this->result = json_decode($result, true); |
| 342 | - Logger::log($this->url . ' response: ', LOG_DEBUG, $this->result); |
|
| 342 | + Logger::log($this->url.' response: ', LOG_DEBUG, $this->result); |
|
| 343 | 343 | $this->info = curl_getinfo($this->con); |
| 344 | 344 | } |
| 345 | 345 | |