@@ -15,7 +15,7 @@ |
||
15 | 15 | } |
16 | 16 | |
17 | 17 | public static function parseRawData($type, array $params = []) { |
18 | - switch($type) { |
|
18 | + switch ($type) { |
|
19 | 19 | default: |
20 | 20 | case self::TYPE_HTTP: |
21 | 21 | $parsedParams = http_build_query($params); |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | protected $isMultipart = false; |
71 | 71 | |
72 | 72 | private function closeConnection() { |
73 | - if(null !== $this->con) { |
|
73 | + if (null !== $this->con) { |
|
74 | 74 | curl_close($this->con); |
75 | 75 | } |
76 | 76 | } |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | */ |
234 | 234 | public function setIsJson($isJson = true) { |
235 | 235 | $this->isJson = $isJson; |
236 | - if($isJson) { |
|
236 | + if ($isJson) { |
|
237 | 237 | $this->setIsMultipart(false); |
238 | 238 | } |
239 | 239 | } |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | */ |
252 | 252 | public function setIsMultipart($isMultipart = true) { |
253 | 253 | $this->isMultipart = $isMultipart; |
254 | - if($isMultipart) { |
|
254 | + if ($isMultipart) { |
|
255 | 255 | $this->setIsJson(false); |
256 | 256 | } |
257 | 257 | } |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | $this->url = NULL; |
272 | 272 | $this->params = array(); |
273 | 273 | $this->headers = array(); |
274 | - Logger::log('Context service for ' . static::class . ' cleared!'); |
|
274 | + Logger::log('Context service for '.static::class.' cleared!'); |
|
275 | 275 | $this->closeConnection(); |
276 | 276 | } |
277 | 277 | |
@@ -314,18 +314,18 @@ discard block |
||
314 | 314 | } |
315 | 315 | |
316 | 316 | protected function applyOptions() { |
317 | - if(count($this->options)) { |
|
317 | + if (count($this->options)) { |
|
318 | 318 | curl_setopt_array($this->con, $this->options); |
319 | 319 | } |
320 | 320 | } |
321 | 321 | |
322 | 322 | protected function applyHeaders() { |
323 | 323 | $headers = []; |
324 | - foreach($this->headers as $key => $value) { |
|
325 | - $headers[] = $key . ': ' . $value; |
|
324 | + foreach ($this->headers as $key => $value) { |
|
325 | + $headers[] = $key.': '.$value; |
|
326 | 326 | } |
327 | 327 | $headers[self::PSFS_TRACK_HEADER] = Logger::getUid(); |
328 | - if(count($headers)) { |
|
328 | + if (count($headers)) { |
|
329 | 329 | curl_setopt($this->con, CURLOPT_HTTPHEADER, $headers); |
330 | 330 | } |
331 | 331 | } |
@@ -334,10 +334,10 @@ discard block |
||
334 | 334 | * @return int |
335 | 335 | */ |
336 | 336 | private function parseServiceType() { |
337 | - if($this->getIsJson()) { |
|
337 | + if ($this->getIsJson()) { |
|
338 | 338 | return ServiceHelper::TYPE_JSON; |
339 | 339 | } |
340 | - if($this->getIsMultipart()) { |
|
340 | + if ($this->getIsMultipart()) { |
|
341 | 341 | return ServiceHelper::TYPE_MULTIPART; |
342 | 342 | } |
343 | 343 | return ServiceHelper::TYPE_HTTP; |
@@ -350,9 +350,9 @@ discard block |
||
350 | 350 | case Request::VERB_GET: |
351 | 351 | default: |
352 | 352 | $this->addOption(CURLOPT_CUSTOMREQUEST, Request::VERB_GET); |
353 | - if(!empty($this->params)) { |
|
353 | + if (!empty($this->params)) { |
|
354 | 354 | $sep = false !== strpos($this->getUrl(), '?') ? '?' : ''; |
355 | - $this->url = $this->url . $sep . http_build_query($this->params); |
|
355 | + $this->url = $this->url.$sep.http_build_query($this->params); |
|
356 | 356 | } |
357 | 357 | break; |
358 | 358 | case Request::VERB_POST: |
@@ -384,14 +384,14 @@ discard block |
||
384 | 384 | $this->applyOptions(); |
385 | 385 | $this->applyHeaders(); |
386 | 386 | $verbose = null; |
387 | - if('debug' === Config::getParam('log.level')) { |
|
387 | + if ('debug' === Config::getParam('log.level')) { |
|
388 | 388 | curl_setopt($this->con, CURLOPT_VERBOSE, true); |
389 | 389 | $verbose = fopen('php://temp', 'wb+'); |
390 | 390 | curl_setopt($this->con, CURLOPT_STDERR, $verbose); |
391 | 391 | } |
392 | 392 | $result = curl_exec($this->con); |
393 | 393 | $this->result = $this->isJson ? json_decode($result, true) : $result; |
394 | - if('debug' === Config::getParam('log.level')) { |
|
394 | + if ('debug' === Config::getParam('log.level')) { |
|
395 | 395 | rewind($verbose); |
396 | 396 | $verboseLog = stream_get_contents($verbose); |
397 | 397 | Logger::log($verboseLog, LOG_DEBUG, [ |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | ]); |
402 | 402 | $this->info['verbose'] = $verboseLog; |
403 | 403 | } |
404 | - Logger::log($this->url . ' response: ', LOG_DEBUG, is_array($this->result) ? $this->result : [$this->result]); |
|
404 | + Logger::log($this->url.' response: ', LOG_DEBUG, is_array($this->result) ? $this->result : [$this->result]); |
|
405 | 405 | $this->info = array_merge($this->info, curl_getinfo($this->con)); |
406 | 406 | } |
407 | 407 |