@@ -589,7 +589,7 @@ discard block |
||
| 589 | 589 | * @return mixed |
| 590 | 590 | * @throws Exception\TransportException |
| 591 | 591 | */ |
| 592 | - public function insertBatchTSVFiles($table_name, $file_names, $columns_array=[]) |
|
| 592 | + public function insertBatchTSVFiles($table_name, $file_names, $columns_array = []) |
|
| 593 | 593 | { |
| 594 | 594 | return $this->insertBatchFiles($table_name, $file_names, $columns_array, 'TabSeparated'); |
| 595 | 595 | } |
@@ -604,7 +604,7 @@ discard block |
||
| 604 | 604 | * @return array |
| 605 | 605 | * @throws Exception\TransportException |
| 606 | 606 | */ |
| 607 | - public function insertBatchFiles($table_name, $file_names, $columns_array=[], $format = "CSV") |
|
| 607 | + public function insertBatchFiles($table_name, $file_names, $columns_array = [], $format = "CSV") |
|
| 608 | 608 | { |
| 609 | 609 | if (is_string($file_names)) |
| 610 | 610 | { |
@@ -659,7 +659,7 @@ discard block |
||
| 659 | 659 | * @param string $format ['TabSeparated','TabSeparatedWithNames','CSV','CSVWithNames'] |
| 660 | 660 | * @return Transport\CurlerRequest |
| 661 | 661 | */ |
| 662 | - public function insertBatchStream($table_name, $columns_array=[], $format = "CSV") |
|
| 662 | + public function insertBatchStream($table_name, $columns_array = [], $format = "CSV") |
|
| 663 | 663 | { |
| 664 | 664 | if ($this->getCountPendingQueue() > 0) { |
| 665 | 665 | throw new QueryException('Queue must be empty, before insertBatch, need executeAsync'); |
@@ -693,12 +693,12 @@ discard block |
||
| 693 | 693 | * @return Statement |
| 694 | 694 | * @throws Exception\TransportException |
| 695 | 695 | */ |
| 696 | - public function streamWrite(Stream $stream,$sql,$bind=[]) |
|
| 696 | + public function streamWrite(Stream $stream, $sql, $bind = []) |
|
| 697 | 697 | { |
| 698 | 698 | if ($this->getCountPendingQueue() > 0) { |
| 699 | 699 | throw new QueryException('Queue must be empty, before streamWrite'); |
| 700 | 700 | } |
| 701 | - return $this->transport()->streamWrite($stream,$sql,$bind); |
|
| 701 | + return $this->transport()->streamWrite($stream, $sql, $bind); |
|
| 702 | 702 | } |
| 703 | 703 | |
| 704 | 704 | |
@@ -711,12 +711,12 @@ discard block |
||
| 711 | 711 | * @return Statement |
| 712 | 712 | * @throws Exception\TransportException |
| 713 | 713 | */ |
| 714 | - public function streamRead(Stream $streamRead,$sql,$bind=[]) |
|
| 714 | + public function streamRead(Stream $streamRead, $sql, $bind = []) |
|
| 715 | 715 | { |
| 716 | 716 | if ($this->getCountPendingQueue() > 0) { |
| 717 | 717 | throw new QueryException('Queue must be empty, before streamWrite'); |
| 718 | 718 | } |
| 719 | - return $this->transport()->streamRead($streamRead,$sql,$bind); |
|
| 719 | + return $this->transport()->streamRead($streamRead, $sql, $bind); |
|
| 720 | 720 | } |
| 721 | 721 | |
| 722 | 722 | /** |
@@ -910,12 +910,12 @@ discard block |
||
| 910 | 910 | * @return array |
| 911 | 911 | * @throws Exception\TransportException |
| 912 | 912 | */ |
| 913 | - public function getServerSystemSettings($like='') |
|
| 913 | + public function getServerSystemSettings($like = '') |
|
| 914 | 914 | { |
| 915 | - $l=[]; |
|
| 916 | - $list=$this->select('SELECT * FROM system.settings'.($like ? ' WHERE name LIKE :like':'' ),['like'=>'%'.$like.'%'])->rows(); |
|
| 915 | + $l = []; |
|
| 916 | + $list = $this->select('SELECT * FROM system.settings' . ($like ? ' WHERE name LIKE :like' : ''), ['like'=>'%' . $like . '%'])->rows(); |
|
| 917 | 917 | foreach ($list as $row) { |
| 918 | - if (isset($row['name'])) {$n=$row['name']; unset($row['name']) ; $l[$n]=$row;} |
|
| 918 | + if (isset($row['name'])) {$n = $row['name']; unset($row['name']); $l[$n] = $row; } |
|
| 919 | 919 | } |
| 920 | 920 | return $l; |
| 921 | 921 | } |
@@ -9,7 +9,7 @@ |
||
| 9 | 9 | class StreamWrite extends Stream |
| 10 | 10 | { |
| 11 | 11 | |
| 12 | - public function __construct( $source) |
|
| 12 | + public function __construct($source) |
|
| 13 | 13 | { |
| 14 | 14 | |
| 15 | 15 | parent::__construct($source); |
@@ -31,7 +31,7 @@ |
||
| 31 | 31 | * @param CurlerRequest $request |
| 32 | 32 | * @param CurlerRolling|null $curlerRolling |
| 33 | 33 | */ |
| 34 | - public function __construct($source, CurlerRequest $request, $curlerRolling=null) |
|
| 34 | + public function __construct($source, CurlerRequest $request, $curlerRolling = null) |
|
| 35 | 35 | { |
| 36 | 36 | if (!is_resource($source)) { |
| 37 | 37 | throw new \InvalidArgumentException('Argument $source must be resource'); |
@@ -293,7 +293,7 @@ |
||
| 293 | 293 | |
| 294 | 294 | if (stripos($format, 'json') !== false) |
| 295 | 295 | { |
| 296 | - if (stripos($format,'JSONEachRow')===false) |
|
| 296 | + if (stripos($format, 'JSONEachRow') === false) |
|
| 297 | 297 | return $this->json(); |
| 298 | 298 | } |
| 299 | 299 | return $this->body(); |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | */ |
| 242 | 242 | public function setWriteFunction($callback) |
| 243 | 243 | { |
| 244 | - $this->options[CURLOPT_WRITEFUNCTION]=$callback; |
|
| 244 | + $this->options[CURLOPT_WRITEFUNCTION] = $callback; |
|
| 245 | 245 | } |
| 246 | 246 | /** |
| 247 | 247 | * @param callable $callback |
@@ -715,7 +715,7 @@ discard block |
||
| 715 | 715 | |
| 716 | 716 | if (!empty($curl_opt[CURLOPT_WRITEFUNCTION])) |
| 717 | 717 | { |
| 718 | - $curl_opt[CURLOPT_HEADER]=false; |
|
| 718 | + $curl_opt[CURLOPT_HEADER] = false; |
|
| 719 | 719 | } |
| 720 | 720 | |
| 721 | 721 | if ($this->resultFileHandle) { |
@@ -15,11 +15,11 @@ discard block |
||
| 15 | 15 | /** |
| 16 | 16 | * @var bool |
| 17 | 17 | */ |
| 18 | - private $gzip=false; |
|
| 18 | + private $gzip = false; |
|
| 19 | 19 | /** |
| 20 | 20 | * @var null|callable |
| 21 | 21 | */ |
| 22 | - private $callable=null; |
|
| 22 | + private $callable = null; |
|
| 23 | 23 | /** |
| 24 | 24 | * @param resource $source |
| 25 | 25 | */ |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | */ |
| 61 | 61 | public function closure(callable $callable) |
| 62 | 62 | { |
| 63 | - $this->callable=$callable; |
|
| 63 | + $this->callable = $callable; |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | /** |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | */ |
| 69 | 69 | public function enableGzipHeader() |
| 70 | 70 | { |
| 71 | - $this->gzip=true; |
|
| 71 | + $this->gzip = true; |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | } |
@@ -219,15 +219,15 @@ discard block |
||
| 219 | 219 | $this->_init = true; |
| 220 | 220 | return false; |
| 221 | 221 | } |
| 222 | - $data=[]; |
|
| 222 | + $data = []; |
|
| 223 | 223 | foreach (['meta', 'data', 'totals', 'extremes', 'rows', 'rows_before_limit_at_least', 'statistics'] as $key) { |
| 224 | 224 | |
| 225 | 225 | if (isset($this->_rawData[$key])) { |
| 226 | - if ($key=='data') |
|
| 226 | + if ($key == 'data') |
|
| 227 | 227 | { |
| 228 | - $data=$this->_rawData[$key]; |
|
| 228 | + $data = $this->_rawData[$key]; |
|
| 229 | 229 | } |
| 230 | - else{ |
|
| 230 | + else { |
|
| 231 | 231 | $this->{$key} = $this->_rawData[$key]; |
| 232 | 232 | } |
| 233 | 233 | |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | throw new QueryException('Can`t find meta'); |
| 239 | 239 | } |
| 240 | 240 | |
| 241 | - $isJSONCompact=(stripos($this->format,'JSONCompact')!==false?true:false); |
|
| 241 | + $isJSONCompact = (stripos($this->format, 'JSONCompact') !== false ?true:false); |
|
| 242 | 242 | $this->array_data = []; |
| 243 | 243 | foreach ($data as $rows) { |
| 244 | 244 | $r = []; |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | |
| 247 | 247 | if ($isJSONCompact) |
| 248 | 248 | { |
| 249 | - $r[]=$rows; |
|
| 249 | + $r[] = $rows; |
|
| 250 | 250 | } |
| 251 | 251 | else { |
| 252 | 252 | foreach ($this->meta as $meta) { |
@@ -87,12 +87,12 @@ discard block |
||
| 87 | 87 | * @param string $pattern |
| 88 | 88 | * @return string |
| 89 | 89 | */ |
| 90 | - public function compile_binds($sql, $binds,$pattern) |
|
| 90 | + public function compile_binds($sql, $binds, $pattern) |
|
| 91 | 91 | { |
| 92 | 92 | return preg_replace_callback($pattern, function($m) use ($binds){ |
| 93 | - if(isset($binds[$m[1]])){ // If it exists in our array |
|
| 93 | + if (isset($binds[$m[1]])) { // If it exists in our array |
|
| 94 | 94 | return $binds[$m[1]]; // Then replace it from our array |
| 95 | - }else{ |
|
| 95 | + } else { |
|
| 96 | 96 | return $m[0]; // Otherwise return the whole match (basically we won't change it) |
| 97 | 97 | } |
| 98 | 98 | }, $sql); |
@@ -109,8 +109,8 @@ discard block |
||
| 109 | 109 | { |
| 110 | 110 | arsort($this->bindings); |
| 111 | 111 | |
| 112 | - $bindFormatted=[]; |
|
| 113 | - $bindRaw=[]; |
|
| 112 | + $bindFormatted = []; |
|
| 113 | + $bindRaw = []; |
|
| 114 | 114 | foreach ($this->bindings as $key => $value) { |
| 115 | 115 | $valueSet = null; |
| 116 | 116 | $formattedParameter = null; |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | $escapedValues = $this->escapeArray($value); |
| 124 | 124 | |
| 125 | 125 | $escapedValues = array_map( |
| 126 | - function ($escapedValue) { |
|
| 126 | + function($escapedValue) { |
|
| 127 | 127 | if (is_string($escapedValue)) { |
| 128 | 128 | return $this->formatStringParameter($escapedValue); |
| 129 | 129 | } |
@@ -148,21 +148,21 @@ discard block |
||
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | if ($formattedParameter !== null) { |
| 151 | - $bindFormatted[$key]=$formattedParameter; |
|
| 151 | + $bindFormatted[$key] = $formattedParameter; |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | if ($valueSet !== null) { |
| 155 | - $bindRaw[$key]=$valueSet; |
|
| 155 | + $bindRaw[$key] = $valueSet; |
|
| 156 | 156 | } |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | - for ($loop=0;$loop<2;$loop++) |
|
| 159 | + for ($loop = 0; $loop < 2; $loop++) |
|
| 160 | 160 | { |
| 161 | 161 | // dipping in binds |
| 162 | 162 | // example ['A' => '{B}' , 'B'=>':C','C'=>123] |
| 163 | - $sql=$this->compile_binds($sql,$bindRaw,'#{([\w+]+)}#'); |
|
| 163 | + $sql = $this->compile_binds($sql, $bindRaw, '#{([\w+]+)}#'); |
|
| 164 | 164 | } |
| 165 | - $sql=$this->compile_binds($sql,$bindFormatted,'#:([\w+]+)#'); |
|
| 165 | + $sql = $this->compile_binds($sql, $bindFormatted, '#:([\w+]+)#'); |
|
| 166 | 166 | |
| 167 | 167 | return $sql; |
| 168 | 168 | } |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | public function execLoopWait() |
| 145 | 145 | { |
| 146 | 146 | $c = 0; |
| 147 | - $count=0; |
|
| 147 | + $count = 0; |
|
| 148 | 148 | // add all tasks |
| 149 | 149 | do { |
| 150 | 150 | $this->exec(); |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | $loop = $this->countActive(); |
| 153 | 153 | $pend = $this->countPending(); |
| 154 | 154 | |
| 155 | - $count=$loop+$pend; |
|
| 155 | + $count = $loop + $pend; |
|
| 156 | 156 | $c++; |
| 157 | 157 | |
| 158 | 158 | if ($c > 20000) { |