@@ -245,8 +245,8 @@ discard block |
||
| 245 | 245 | foreach (['meta', 'data', 'totals', 'extremes', 'rows', 'rows_before_limit_at_least', 'statistics'] as $key) { |
| 246 | 246 | |
| 247 | 247 | if (isset($this->_rawData[$key])) { |
| 248 | - if ($key=='data') { |
|
| 249 | - $data=$this->_rawData[$key]; |
|
| 248 | + if ($key == 'data') { |
|
| 249 | + $data = $this->_rawData[$key]; |
|
| 250 | 250 | } else { |
| 251 | 251 | $this->{$key} = $this->_rawData[$key]; |
| 252 | 252 | } |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | throw new QueryException('Can`t find meta'); |
| 258 | 258 | } |
| 259 | 259 | |
| 260 | - $isJSONCompact=(stripos($this->format,'JSONCompact')!==false?true:false); |
|
| 260 | + $isJSONCompact = (stripos($this->format, 'JSONCompact') !== false ?true:false); |
|
| 261 | 261 | $this->array_data = []; |
| 262 | 262 | foreach ($data as $rows) { |
| 263 | 263 | $r = []; |
@@ -419,14 +419,14 @@ discard block |
||
| 419 | 419 | */ |
| 420 | 420 | public function resetIterator() |
| 421 | 421 | { |
| 422 | - $this->iterator=0; |
|
| 422 | + $this->iterator = 0; |
|
| 423 | 423 | } |
| 424 | 424 | |
| 425 | 425 | public function fetchRow($key = null) |
| 426 | 426 | { |
| 427 | 427 | $this->init(); |
| 428 | 428 | |
| 429 | - $position=$this->iterator; |
|
| 429 | + $position = $this->iterator; |
|
| 430 | 430 | |
| 431 | 431 | if (!isset($this->array_data[$position])) { |
| 432 | 432 | return null; |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | } |
| 267 | 267 | |
| 268 | 268 | $new->timeOut($this->settings()->getTimeOut()); |
| 269 | - $new->connectTimeOut($this->_connectTimeOut);//->keepAlive(); // one sec |
|
| 269 | + $new->connectTimeOut($this->_connectTimeOut); //->keepAlive(); // one sec |
|
| 270 | 270 | $new->verbose(boolval($this->_verbose)); |
| 271 | 271 | |
| 272 | 272 | return $new; |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | public function setStdErrOut($stream) |
| 319 | 319 | { |
| 320 | 320 | if (is_resource($stream)) { |
| 321 | - $this->stdErrOut=$stream; |
|
| 321 | + $this->stdErrOut = $stream; |
|
| 322 | 322 | } |
| 323 | 323 | |
| 324 | 324 | } |
@@ -387,7 +387,7 @@ discard block |
||
| 387 | 387 | |
| 388 | 388 | $request->url($url); |
| 389 | 389 | |
| 390 | - $request->setCallbackFunction(function (CurlerRequest $request) { |
|
| 390 | + $request->setCallbackFunction(function(CurlerRequest $request) { |
|
| 391 | 391 | $handle = $request->getInfileHandle(); |
| 392 | 392 | if (is_resource($handle)) { |
| 393 | 393 | fclose($handle); |
@@ -526,7 +526,7 @@ discard block |
||
| 526 | 526 | } |
| 527 | 527 | |
| 528 | 528 | |
| 529 | - $request->setResultFileHandle($fout, $isGz)->setCallbackFunction(function (CurlerRequest $request) { |
|
| 529 | + $request->setResultFileHandle($fout, $isGz)->setCallbackFunction(function(CurlerRequest $request) { |
|
| 530 | 530 | fclose($request->getResultFileHandle()); |
| 531 | 531 | }); |
| 532 | 532 | } |
@@ -717,11 +717,11 @@ discard block |
||
| 717 | 717 | if (!is_callable($callable)) { |
| 718 | 718 | if ($streamRW->isWrite()) { |
| 719 | 719 | |
| 720 | - $callable = function ($ch, $fd, $length) use ($stream) { |
|
| 720 | + $callable = function($ch, $fd, $length) use ($stream) { |
|
| 721 | 721 | return ($line = fread($stream, $length)) ? $line : ''; |
| 722 | 722 | }; |
| 723 | 723 | } else { |
| 724 | - $callable = function ($ch, $fd) use ($stream) { |
|
| 724 | + $callable = function($ch, $fd) use ($stream) { |
|
| 725 | 725 | return fwrite($stream, $fd); |
| 726 | 726 | }; |
| 727 | 727 | } |
@@ -341,7 +341,7 @@ discard block |
||
| 341 | 341 | */ |
| 342 | 342 | public function enableLogQueries(bool $flag = true) |
| 343 | 343 | { |
| 344 | - $this->settings()->set('log_queries', (int)$flag); |
|
| 344 | + $this->settings()->set('log_queries', (int) $flag); |
|
| 345 | 345 | |
| 346 | 346 | return $this; |
| 347 | 347 | } |
@@ -377,7 +377,7 @@ discard block |
||
| 377 | 377 | */ |
| 378 | 378 | public function enableExtremes(bool $flag = true) |
| 379 | 379 | { |
| 380 | - $this->settings()->set('extremes', (int)$flag); |
|
| 380 | + $this->settings()->set('extremes', (int) $flag); |
|
| 381 | 381 | |
| 382 | 382 | return $this; |
| 383 | 383 | } |
@@ -740,9 +740,9 @@ discard block |
||
| 740 | 740 | * @return bool |
| 741 | 741 | * @throws TransportException |
| 742 | 742 | */ |
| 743 | - public function ping(bool $throwException=false): bool |
|
| 743 | + public function ping(bool $throwException = false): bool |
|
| 744 | 744 | { |
| 745 | - $result=$this->transport()->ping(); |
|
| 745 | + $result = $this->transport()->ping(); |
|
| 746 | 746 | if ($throwException && !$result) throw new TransportException('Can`t ping server'); |
| 747 | 747 | return $result; |
| 748 | 748 | } |
@@ -811,7 +811,7 @@ discard block |
||
| 811 | 811 | public function partitions(string $table, int $limit = null, bool $active = null) |
| 812 | 812 | { |
| 813 | 813 | $database = $this->settings()->getDatabase(); |
| 814 | - $whereActiveClause = $active === null ? '' : sprintf(' AND active = %s', (int)$active); |
|
| 814 | + $whereActiveClause = $active === null ? '' : sprintf(' AND active = %s', (int) $active); |
|
| 815 | 815 | $limitClause = $limit !== null ? ' LIMIT ' . $limit : ''; |
| 816 | 816 | |
| 817 | 817 | return $this->select(<<<CLICKHOUSE |
@@ -877,7 +877,7 @@ discard block |
||
| 877 | 877 | */ |
| 878 | 878 | public function getServerVersion(): string |
| 879 | 879 | { |
| 880 | - return (string)$this->select('SELECT version() as version')->fetchOne('version'); |
|
| 880 | + return (string) $this->select('SELECT version() as version')->fetchOne('version'); |
|
| 881 | 881 | } |
| 882 | 882 | |
| 883 | 883 | /** |
@@ -177,7 +177,7 @@ |
||
| 177 | 177 | */ |
| 178 | 178 | public function max_execution_time(float $time) |
| 179 | 179 | { |
| 180 | - $this->set('max_execution_time',$time); |
|
| 180 | + $this->set('max_execution_time', $time); |
|
| 181 | 181 | return $this; |
| 182 | 182 | } |
| 183 | 183 | |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | public function setStdErrOut($stream) |
| 308 | 308 | { |
| 309 | 309 | if (is_resource($stream)) { |
| 310 | - $this->stdErrOut=$stream; |
|
| 310 | + $this->stdErrOut = $stream; |
|
| 311 | 311 | } |
| 312 | 312 | |
| 313 | 313 | } |
@@ -493,7 +493,7 @@ discard block |
||
| 493 | 493 | */ |
| 494 | 494 | public function connectTimeOut(float $seconds = 1.0) |
| 495 | 495 | { |
| 496 | - $this->options[CURLOPT_CONNECTTIMEOUT_MS] = (int) ($seconds*1000.0); |
|
| 496 | + $this->options[CURLOPT_CONNECTTIMEOUT_MS] = (int) ($seconds * 1000.0); |
|
| 497 | 497 | return $this; |
| 498 | 498 | } |
| 499 | 499 | |
@@ -736,7 +736,7 @@ discard block |
||
| 736 | 736 | $curl_opt[CURLOPT_POSTFIELDS] = $this->parameters; |
| 737 | 737 | |
| 738 | 738 | if (!is_array($this->parameters)) { |
| 739 | - $this->header('Content-Length', mb_strlen($this->parameters, '8bit')); |
|
| 739 | + $this->header('Content-Length', mb_strlen($this->parameters, '8bit')); |
|
| 740 | 740 | } |
| 741 | 741 | } |
| 742 | 742 | } |
@@ -767,9 +767,9 @@ discard block |
||
| 767 | 767 | } |
| 768 | 768 | |
| 769 | 769 | if ($this->options[CURLOPT_VERBOSE]) { |
| 770 | - $msg="\n-----------BODY REQUEST----------\n" . $curl_opt[CURLOPT_POSTFIELDS] . "\n------END--------\n"; |
|
| 770 | + $msg = "\n-----------BODY REQUEST----------\n" . $curl_opt[CURLOPT_POSTFIELDS] . "\n------END--------\n"; |
|
| 771 | 771 | if ($this->stdErrOut && is_resource($this->stdErrOut)) { |
| 772 | - fwrite($this->stdErrOut,$msg); |
|
| 772 | + fwrite($this->stdErrOut, $msg); |
|
| 773 | 773 | } else { |
| 774 | 774 | echo $msg; |
| 775 | 775 | } |
@@ -777,7 +777,7 @@ discard block |
||
| 777 | 777 | |
| 778 | 778 | if ($this->stdErrOut) { |
| 779 | 779 | if (is_resource($this->stdErrOut)) { |
| 780 | - $curl_opt[CURLOPT_STDERR]=$this->stdErrOut; |
|
| 780 | + $curl_opt[CURLOPT_STDERR] = $this->stdErrOut; |
|
| 781 | 781 | } |
| 782 | 782 | } |
| 783 | 783 | |