@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | $this->transport->addQueryDegeneration(new Bindings()); |
82 | 82 | |
83 | 83 | // apply settings to transport class |
84 | - if (! empty($settings)) { |
|
84 | + if (!empty($settings)) { |
|
85 | 85 | $this->getSettings()->apply($settings); |
86 | 86 | } |
87 | 87 | |
@@ -195,8 +195,8 @@ discard block |
||
195 | 195 | */ |
196 | 196 | public function useSession(bool $useSessionId = false) |
197 | 197 | { |
198 | - if (! $this->getSettings()->getSessionId()) { |
|
199 | - if (! $useSessionId) { |
|
198 | + if (!$this->getSettings()->getSessionId()) { |
|
199 | + if (!$useSessionId) { |
|
200 | 200 | $this->getSettings()->makeSessionId(); |
201 | 201 | } else { |
202 | 202 | $this->getSettings()->session_id($useSessionId); |
@@ -322,14 +322,14 @@ discard block |
||
322 | 322 | */ |
323 | 323 | public function progressFunction(callable $callback) |
324 | 324 | { |
325 | - if (! is_callable($callback)) { |
|
325 | + if (!is_callable($callback)) { |
|
326 | 326 | throw new \InvalidArgumentException('Not is_callable progressFunction'); |
327 | 327 | } |
328 | 328 | |
329 | - if (! $this->getSettings()->isSet('send_progress_in_http_headers')) { |
|
329 | + if (!$this->getSettings()->isSet('send_progress_in_http_headers')) { |
|
330 | 330 | $this->getSettings()->set('send_progress_in_http_headers', 1); |
331 | 331 | } |
332 | - if (! $this->getSettings()->isSet('http_headers_progress_interval_ms')) { |
|
332 | + if (!$this->getSettings()->isSet('http_headers_progress_interval_ms')) { |
|
333 | 333 | $this->getSettings()->set('http_headers_progress_interval_ms', 100); |
334 | 334 | } |
335 | 335 | |
@@ -463,14 +463,14 @@ discard block |
||
463 | 463 | throw new QueryException('Queue must be empty, before insertBatch, need executeAsync'); |
464 | 464 | } |
465 | 465 | |
466 | - if (! in_array($format, self::SUPPORTED_FORMATS, true)) { |
|
466 | + if (!in_array($format, self::SUPPORTED_FORMATS, true)) { |
|
467 | 467 | throw new QueryException('Format not support in insertBatchFiles'); |
468 | 468 | } |
469 | 469 | |
470 | 470 | $result = []; |
471 | 471 | |
472 | 472 | foreach ($fileNames as $fileName) { |
473 | - if (! is_file($fileName) || ! is_readable($fileName)) { |
|
473 | + if (!is_file($fileName) || !is_readable($fileName)) { |
|
474 | 474 | throw new QueryException('Cant read file: ' . $fileName . ' ' . (is_file($fileName) ? '' : ' is not file')); |
475 | 475 | } |
476 | 476 | |
@@ -487,7 +487,7 @@ discard block |
||
487 | 487 | |
488 | 488 | // fetch resutl |
489 | 489 | foreach ($fileNames as $fileName) { |
490 | - if (! $result[$fileName]->isError()) { |
|
490 | + if (!$result[$fileName]->isError()) { |
|
491 | 491 | continue; |
492 | 492 | } |
493 | 493 | |
@@ -510,7 +510,7 @@ discard block |
||
510 | 510 | throw new QueryException('Queue must be empty, before insertBatch, need executeAsync'); |
511 | 511 | } |
512 | 512 | |
513 | - if (! in_array($format, self::SUPPORTED_FORMATS, true)) { |
|
513 | + if (!in_array($format, self::SUPPORTED_FORMATS, true)) { |
|
514 | 514 | throw new QueryException('Format not support in insertBatchFiles'); |
515 | 515 | } |
516 | 516 |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | */ |
19 | 19 | public function get(string $key) |
20 | 20 | { |
21 | - if (! $this->isSet($key)) { |
|
21 | + if (!$this->isSet($key)) { |
|
22 | 22 | return null; |
23 | 23 | } |
24 | 24 | |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | public function getQueryableSettings(array $forcedSettings) : array |
101 | 101 | { |
102 | 102 | $settings = $this->settings; |
103 | - if (! empty($forcedSettings)) { |
|
103 | + if (!empty($forcedSettings)) { |
|
104 | 104 | $settings = $forcedSettings + $this->settings; |
105 | 105 | } |
106 | 106 | |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | */ |
127 | 127 | public function getSetting($name) |
128 | 128 | { |
129 | - if (! isset($this->settings[$name])) { |
|
129 | + if (!isset($this->settings[$name])) { |
|
130 | 130 | return null; |
131 | 131 | } |
132 | 132 |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | $new = $this->newRequest($extendinfo); |
221 | 221 | $new->url($url); |
222 | 222 | |
223 | - if (! $query_as_string) { |
|
223 | + if (!$query_as_string) { |
|
224 | 224 | $new->parameters_json($sql); |
225 | 225 | } |
226 | 226 | if ($this->getSettings()->isHttpCompressionEnabled()) { |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | $request = $this->newRequest($extendinfo); |
282 | 282 | $request->url($url); |
283 | 283 | |
284 | - $request->setCallbackFunction(function (CurlerRequest $request) { |
|
284 | + $request->setCallbackFunction(function(CurlerRequest $request) { |
|
285 | 285 | $handle = $request->getInfileHandle(); |
286 | 286 | if (is_resource($handle)) { |
287 | 287 | fclose($handle); |
@@ -338,17 +338,17 @@ discard block |
||
338 | 338 | if ($code == 200) { |
339 | 339 | $response = curl_multi_getcontent($handle); |
340 | 340 | $header_size = curl_getinfo($handle, CURLINFO_HEADER_SIZE); |
341 | - if (! $header_size) { |
|
341 | + if (!$header_size) { |
|
342 | 342 | return false; |
343 | 343 | } |
344 | 344 | |
345 | 345 | $header = substr($response, 0, $header_size); |
346 | - if (! $header_size) { |
|
346 | + if (!$header_size) { |
|
347 | 347 | return false; |
348 | 348 | } |
349 | 349 | $pos = strrpos($header, 'X-ClickHouse-Progress'); |
350 | 350 | |
351 | - if (! $pos) { |
|
351 | + if (!$pos) { |
|
352 | 352 | return false; |
353 | 353 | } |
354 | 354 | |
@@ -413,13 +413,13 @@ discard block |
||
413 | 413 | fwrite($fout, "\x1f\x8b\x08\x00\x00\x00\x00\x00"); |
414 | 414 | } |
415 | 415 | |
416 | - $request->setResultFileHandle($fout, $isGz)->setCallbackFunction(function (CurlerRequest $request) { |
|
416 | + $request->setResultFileHandle($fout, $isGz)->setCallbackFunction(function(CurlerRequest $request) { |
|
417 | 417 | fclose($request->getResultFileHandle()); |
418 | 418 | }); |
419 | 419 | } |
420 | 420 | } |
421 | 421 | if ($this->xClickHouseProgress !== null) { |
422 | - $request->setFunctionProgress(function ($x) { |
|
422 | + $request->setFunctionProgress(function($x) { |
|
423 | 423 | return $this->findXClickHouseProgress($x); |
424 | 424 | }); |
425 | 425 | } |
@@ -594,14 +594,14 @@ discard block |
||
594 | 594 | |
595 | 595 | try { |
596 | 596 | |
597 | - if (! is_callable($callable)) { |
|
597 | + if (!is_callable($callable)) { |
|
598 | 598 | if ($streamRW->isWrite()) { |
599 | 599 | |
600 | - $callable = function ($ch, $fd, $length) use ($stream) { |
|
600 | + $callable = function($ch, $fd, $length) use ($stream) { |
|
601 | 601 | return ($line = fread($stream, $length)) ? $line : ''; |
602 | 602 | }; |
603 | 603 | } else { |
604 | - $callable = function ($ch, $fd) use ($stream) { |
|
604 | + $callable = function($ch, $fd) use ($stream) { |
|
605 | 605 | return fwrite($stream, $fd); |
606 | 606 | }; |
607 | 607 | } |
@@ -634,8 +634,9 @@ |
||
634 | 634 | |
635 | 635 | return $response; |
636 | 636 | } finally { |
637 | - if ($streamRW->isWrite()) |
|
638 | - fclose($stream); |
|
637 | + if ($streamRW->isWrite()) { |
|
638 | + fclose($stream); |
|
639 | + } |
|
639 | 640 | } |
640 | 641 | } |
641 | 642 |