@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | */ |
23 | 23 | private $degenerations = []; |
24 | 24 | |
25 | - private $supportFormats=[ |
|
25 | + private $supportFormats = [ |
|
26 | 26 | "FORMAT\\s+TSVRaw", |
27 | 27 | "FORMAT\\s+TSVWithNamesAndTypes", |
28 | 28 | "FORMAT\\s+TSVWithNames", |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | if (null === $this->format) { |
72 | 72 | return false; |
73 | 73 | } |
74 | - $supportFormats = implode("|",$this->supportFormats); |
|
74 | + $supportFormats = implode("|", $this->supportFormats); |
|
75 | 75 | |
76 | 76 | $matches = []; |
77 | 77 | if (preg_match_all('%(' . $supportFormats . ')%ius', $this->sql, $matches)) { |
@@ -63,19 +63,19 @@ discard block |
||
63 | 63 | */ |
64 | 64 | public function __construct(array $connectParams, array $settings = []) |
65 | 65 | { |
66 | - if (! isset($connectParams['username'])) { |
|
66 | + if (!isset($connectParams['username'])) { |
|
67 | 67 | throw new \InvalidArgumentException('not set username'); |
68 | 68 | } |
69 | 69 | |
70 | - if (! isset($connectParams['password'])) { |
|
70 | + if (!isset($connectParams['password'])) { |
|
71 | 71 | throw new \InvalidArgumentException('not set password'); |
72 | 72 | } |
73 | 73 | |
74 | - if (! isset($connectParams['port'])) { |
|
74 | + if (!isset($connectParams['port'])) { |
|
75 | 75 | throw new \InvalidArgumentException('not set port'); |
76 | 76 | } |
77 | 77 | |
78 | - if (! isset($connectParams['host'])) { |
|
78 | + if (!isset($connectParams['host'])) { |
|
79 | 79 | throw new \InvalidArgumentException('not set host'); |
80 | 80 | } |
81 | 81 | |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | |
97 | 97 | // apply settings to transport class |
98 | 98 | $this->settings()->database('default'); |
99 | - if (! empty($settings)) { |
|
99 | + if (!empty($settings)) { |
|
100 | 100 | $this->settings()->apply($settings); |
101 | 101 | } |
102 | 102 | |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | */ |
199 | 199 | public function transport() |
200 | 200 | { |
201 | - if (! $this->transport) { |
|
201 | + if (!$this->transport) { |
|
202 | 202 | throw new \InvalidArgumentException('Empty transport class'); |
203 | 203 | } |
204 | 204 | |
@@ -267,8 +267,8 @@ discard block |
||
267 | 267 | */ |
268 | 268 | public function useSession(string $useSessionId = null) |
269 | 269 | { |
270 | - if (! $this->settings()->getSessionId()) { |
|
271 | - if (! $useSessionId) { |
|
270 | + if (!$this->settings()->getSessionId()) { |
|
271 | + if (!$useSessionId) { |
|
272 | 272 | $this->settings()->makeSessionId(); |
273 | 273 | } else { |
274 | 274 | $this->settings()->session_id($useSessionId); |
@@ -386,14 +386,14 @@ discard block |
||
386 | 386 | */ |
387 | 387 | public function progressFunction(callable $callback) |
388 | 388 | { |
389 | - if (! is_callable($callback)) { |
|
389 | + if (!is_callable($callback)) { |
|
390 | 390 | throw new \InvalidArgumentException('Not is_callable progressFunction'); |
391 | 391 | } |
392 | 392 | |
393 | - if (! $this->settings()->is('send_progress_in_http_headers')) { |
|
393 | + if (!$this->settings()->is('send_progress_in_http_headers')) { |
|
394 | 394 | $this->settings()->set('send_progress_in_http_headers', 1); |
395 | 395 | } |
396 | - if (! $this->settings()->is('http_headers_progress_interval_ms')) { |
|
396 | + if (!$this->settings()->is('http_headers_progress_interval_ms')) { |
|
397 | 397 | $this->settings()->set('http_headers_progress_interval_ms', 100); |
398 | 398 | } |
399 | 399 | |
@@ -574,14 +574,14 @@ discard block |
||
574 | 574 | throw new QueryException('Queue must be empty, before insertBatch, need executeAsync'); |
575 | 575 | } |
576 | 576 | |
577 | - if (! in_array($format, self::SUPPORTED_FORMATS, true)) { |
|
577 | + if (!in_array($format, self::SUPPORTED_FORMATS, true)) { |
|
578 | 578 | throw new QueryException('Format not support in insertBatchFiles'); |
579 | 579 | } |
580 | 580 | |
581 | 581 | $result = []; |
582 | 582 | |
583 | 583 | foreach ($fileNames as $fileName) { |
584 | - if (! is_file($fileName) || ! is_readable($fileName)) { |
|
584 | + if (!is_file($fileName) || !is_readable($fileName)) { |
|
585 | 585 | throw new QueryException('Cant read file: ' . $fileName . ' ' . (is_file($fileName) ? '' : ' is not file')); |
586 | 586 | } |
587 | 587 | |
@@ -598,7 +598,7 @@ discard block |
||
598 | 598 | |
599 | 599 | // fetch resutl |
600 | 600 | foreach ($fileNames as $fileName) { |
601 | - if (! $result[$fileName]->isError()) { |
|
601 | + if (!$result[$fileName]->isError()) { |
|
602 | 602 | continue; |
603 | 603 | } |
604 | 604 | |
@@ -621,7 +621,7 @@ discard block |
||
621 | 621 | throw new QueryException('Queue must be empty, before insertBatch, need executeAsync'); |
622 | 622 | } |
623 | 623 | |
624 | - if (! in_array($format, self::SUPPORTED_FORMATS, true)) { |
|
624 | + if (!in_array($format, self::SUPPORTED_FORMATS, true)) { |
|
625 | 625 | throw new QueryException('Format not support in insertBatchFiles'); |
626 | 626 | } |
627 | 627 |
@@ -75,7 +75,7 @@ |
||
75 | 75 | $markers = $this->bindings; |
76 | 76 | |
77 | 77 | // ------ if/else conditions & if[set|int]/else conditions ----- |
78 | - $sql = preg_replace_callback('#\{if(.{0,}?)\s+([^\}]+?)\}(.+?)(\{else\}([^\{]+?)?)?\s*\{\/if}#sui', function ($matches) use ($markers) { |
|
78 | + $sql = preg_replace_callback('#\{if(.{0,}?)\s+([^\}]+?)\}(.+?)(\{else\}([^\{]+?)?)?\s*\{\/if}#sui', function($matches) use ($markers) { |
|
79 | 79 | return self::__ifsets($matches, $markers); |
80 | 80 | } |
81 | 81 | , $sql); |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | /** |
84 | 84 | * @var int |
85 | 85 | */ |
86 | - public $iterator=0; |
|
86 | + public $iterator = 0; |
|
87 | 87 | |
88 | 88 | |
89 | 89 | public function __construct(CurlerRequest $request) |
@@ -221,15 +221,15 @@ discard block |
||
221 | 221 | $this->_init = true; |
222 | 222 | return false; |
223 | 223 | } |
224 | - $data=[]; |
|
224 | + $data = []; |
|
225 | 225 | foreach (['meta', 'data', 'totals', 'extremes', 'rows', 'rows_before_limit_at_least', 'statistics'] as $key) { |
226 | 226 | |
227 | 227 | if (isset($this->_rawData[$key])) { |
228 | - if ($key=='data') |
|
228 | + if ($key == 'data') |
|
229 | 229 | { |
230 | - $data=$this->_rawData[$key]; |
|
230 | + $data = $this->_rawData[$key]; |
|
231 | 231 | } |
232 | - else{ |
|
232 | + else { |
|
233 | 233 | $this->{$key} = $this->_rawData[$key]; |
234 | 234 | } |
235 | 235 | |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | throw new QueryException('Can`t find meta'); |
241 | 241 | } |
242 | 242 | |
243 | - $isJSONCompact=(stripos($this->format,'JSONCompact')!==false?true:false); |
|
243 | + $isJSONCompact = (stripos($this->format, 'JSONCompact') !== false ?true:false); |
|
244 | 244 | $this->array_data = []; |
245 | 245 | foreach ($data as $rows) { |
246 | 246 | $r = []; |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | |
249 | 249 | if ($isJSONCompact) |
250 | 250 | { |
251 | - $r[]=$rows; |
|
251 | + $r[] = $rows; |
|
252 | 252 | } |
253 | 253 | else { |
254 | 254 | foreach ($this->meta as $meta) { |
@@ -404,14 +404,14 @@ discard block |
||
404 | 404 | */ |
405 | 405 | public function resetIterator() |
406 | 406 | { |
407 | - $this->iterator=0; |
|
407 | + $this->iterator = 0; |
|
408 | 408 | } |
409 | 409 | |
410 | 410 | public function fetchRow($key = null) |
411 | 411 | { |
412 | 412 | $this->init(); |
413 | 413 | |
414 | - $position=$this->iterator; |
|
414 | + $position = $this->iterator; |
|
415 | 415 | |
416 | 416 | if (!isset($this->array_data[$position])) { |
417 | 417 | return null; |
@@ -228,8 +228,7 @@ discard block |
||
228 | 228 | if ($key=='data') |
229 | 229 | { |
230 | 230 | $data=$this->_rawData[$key]; |
231 | - } |
|
232 | - else{ |
|
231 | + } else{ |
|
233 | 232 | $this->{$key} = $this->_rawData[$key]; |
234 | 233 | } |
235 | 234 | |
@@ -249,8 +248,7 @@ discard block |
||
249 | 248 | if ($isJSONCompact) |
250 | 249 | { |
251 | 250 | $r[]=$rows; |
252 | - } |
|
253 | - else { |
|
251 | + } else { |
|
254 | 252 | foreach ($this->meta as $meta) { |
255 | 253 | $r[$meta['name']] = $rows[$meta['name']]; |
256 | 254 | } |
@@ -364,7 +362,9 @@ discard block |
||
364 | 362 | return null; |
365 | 363 | } |
366 | 364 | |
367 | - if (!$key) return $this->statistics; |
|
365 | + if (!$key) { |
|
366 | + return $this->statistics; |
|
367 | + } |
|
368 | 368 | |
369 | 369 | if (!isset($this->statistics[$key])) { |
370 | 370 | return null; |