Completed
Branch master (48dd8f)
by Igor
05:34 queued 02:55
created
src/Client.php 1 patch
Braces   +7 added lines, -8 removed lines patch added patch discarded remove patch
@@ -295,8 +295,7 @@  discard block
 block discarded – undo
295 295
             if (!$useSessionId)
296 296
             {
297 297
                 $this->settings()->makeSessionId();
298
-            }
299
-            else
298
+            } else
300 299
             {
301 300
                 $this->settings()->session_id($useSessionId);
302 301
             }
@@ -415,7 +414,9 @@  discard block
 block discarded – undo
415 414
      */
416 415
     public function progressFunction($callback)
417 416
     {
418
-        if (!is_callable($callback)) throw new \InvalidArgumentException('Not is_callable progressFunction');
417
+        if (!is_callable($callback)) {
418
+            throw new \InvalidArgumentException('Not is_callable progressFunction');
419
+        }
419 420
 
420 421
         if (!$this->settings()->is('send_progress_in_http_headers'))
421 422
         {
@@ -540,7 +541,7 @@  discard block
 block discarded – undo
540 541
                 }
541 542
                 $preparedValues[] = array_values($row);
542 543
             }
543
-        }else{ //одна строка
544
+        } else{ //одна строка
544 545
             $preparedFields = array_keys($values);
545 546
             $preparedValues = [array_values($values)];
546 547
         }
@@ -609,8 +610,7 @@  discard block
 block discarded – undo
609 610
             {
610 611
                 $sql = 'INSERT INTO ' . $table_name . ' FORMAT '.$format;
611 612
 
612
-            }
613
-            else
613
+            } else
614 614
             {
615 615
                 $sql = 'INSERT INTO ' . $table_name . ' ( ' . implode(',', $columns_array) . ' ) FORMAT '.$format;
616 616
 
@@ -654,8 +654,7 @@  discard block
 block discarded – undo
654 654
         {
655 655
             $sql = 'INSERT INTO ' . $table_name . ' FORMAT '.$format;
656 656
 
657
-        }
658
-        else
657
+        } else
659 658
         {
660 659
             $sql = 'INSERT INTO ' . $table_name . ' ( ' . implode(',', $columns_array) . ' ) FORMAT '.$format;
661 660
 
Please login to merge, or discard this patch.
src/Transport/CurlerRequest.php 1 patch
Braces   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -353,8 +353,9 @@  discard block
 block discarded – undo
353 353
     public function getHeaders()
354 354
     {
355 355
         $head=[];
356
-        foreach ($this->headers as $key=>$value)
357
-            $head[]= sprintf("%s: %s", $key, $value);
356
+        foreach ($this->headers as $key=>$value) {
357
+                    $head[]= sprintf("%s: %s", $key, $value);
358
+        }
358 359
         return $head;
359 360
     }
360 361
 
@@ -394,8 +395,7 @@  discard block
 block discarded – undo
394 395
         if ($flag) {
395 396
             $this->_httpCompression = $flag;
396 397
             $this->options[CURLOPT_ENCODING] = 'gzip';
397
-        }
398
-        else
398
+        } else
399 399
         {
400 400
             $this->_httpCompression = false;
401 401
             unset($this->options[CURLOPT_ENCODING]);
Please login to merge, or discard this patch.
src/Transport/CurlerRolling.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -176,8 +176,7 @@  discard block
 block discarded – undo
176 176
         foreach (explode("\r\n", $header_text) as $i => $line) {
177 177
             if ($i === 0) {
178 178
                 $headers['http_code'] = $line;
179
-            }
180
-            else {
179
+            } else {
181 180
                 $r = explode(': ', $line);
182 181
                 if (sizeof($r) == 2) {
183 182
                     $headers[$r[0]] = $r[1];
@@ -354,8 +353,7 @@  discard block
 block discarded – undo
354 353
             if (sizeof($add)) {
355 354
                 if ($canAdd >= sizeof($add)) {
356 355
                     $ll = $add;
357
-                }
358
-                else {
356
+                } else {
359 357
                     $ll = array_rand($add, $canAdd);
360 358
                     if (!is_array($ll)) {
361 359
                         $ll = array($ll => $ll);
Please login to merge, or discard this patch.
src/Transport/Http.php 1 patch
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -114,7 +114,9 @@  discard block
 block discarded – undo
114 114
     public function getUri()
115 115
     {
116 116
         $proto='http';
117
-        if ($this->settings()->isHttps()) $proto='https';
117
+        if ($this->settings()->isHttps()) {
118
+            $proto='https';
119
+        }
118 120
 
119 121
         return $proto.'://' . $this->_host . ':' . $this->_port;
120 122
     }
@@ -328,13 +330,19 @@  discard block
 block discarded – undo
328 330
         if ($code==200) {
329 331
             $response = curl_multi_getcontent($handle);
330 332
             $header_size = curl_getinfo($handle, CURLINFO_HEADER_SIZE);
331
-            if (!$header_size) return false;
333
+            if (!$header_size) {
334
+                return false;
335
+            }
332 336
 
333 337
             $header = substr($response, 0, $header_size);
334
-            if (!$header_size) return false;
338
+            if (!$header_size) {
339
+                return false;
340
+            }
335 341
             $pos=strrpos($header,'X-ClickHouse-Progress');
336 342
 
337
-            if (!$pos) return false;
343
+            if (!$pos) {
344
+                return false;
345
+            }
338 346
 
339 347
             $last=substr($header,$pos);
340 348
             $data=@json_decode(str_ireplace('X-ClickHouse-Progress:','',$last),true);
Please login to merge, or discard this patch.
src/Cluster.php 1 patch
Braces   +29 added lines, -13 removed lines patch added patch discarded remove patch
@@ -193,7 +193,9 @@  discard block
 block discarded – undo
193 193
 //            if ($replica['total_replicas']<2) {$ok=false;$this->error[]='total_replicas : '.json_encode($replica);}
194 194
             if ($this->softCheck )
195 195
             {
196
-                if (!$ok) break;
196
+                if (!$ok) {
197
+                    break;
198
+                }
197 199
                 continue;
198 200
             }
199 201
 
@@ -209,7 +211,9 @@  discard block
 block discarded – undo
209 211
                 $ok = false;
210 212
                 $this->error[] = 'log_max_index : ' . json_encode($replica);
211 213
             }
212
-            if (!$ok) break;
214
+            if (!$ok) {
215
+                break;
216
+            }
213 217
         }
214 218
         return $ok;
215 219
     }
@@ -308,7 +312,9 @@  discard block
 block discarded – undo
308 312
             // Let's check that replication goes well
309 313
             $rIsOk = $this->isReplicasWork($result['replicas'][$node]);
310 314
             $result['replicasIsOk'][$node] = $rIsOk;
311
-            if (!$rIsOk) $replicasIsOk = false;
315
+            if (!$rIsOk) {
316
+                $replicasIsOk = false;
317
+            }
312 318
             // ---------------------------------------------------------------------------------------------------
313 319
         }
314 320
 
@@ -328,7 +334,9 @@  discard block
 block discarded – undo
328 334
             $this->error[] = 'Have bad node : ' . json_encode($this->badNodes);
329 335
             $this->replicasIsOk = false;
330 336
         }
331
-        if (!sizeof($this->error)) $this->error = false;
337
+        if (!sizeof($this->error)) {
338
+            $this->error = false;
339
+        }
332 340
         $this->resultScan = $result;
333 341
         // @todo  : We connect to everyone in the DNS list, we need to decry that the requests were returned by all the hosts to which we connected
334 342
         return $this;
@@ -376,16 +384,19 @@  discard block
 block discarded – undo
376 384
                     if (in_array($node,$nodes_check))
377 385
                     {
378 386
                         $find=$node;
379
-                    }
380
-                    else
387
+                    } else
381 388
                     {
382 389
                         // node exists on cluster, but not check
383 390
                     }
384 391
 
385 392
                 }
386
-                if ($find) break;
393
+                if ($find) {
394
+                    break;
395
+                }
396
+            }
397
+            if ($find) {
398
+                break;
387 399
             }
388
-            if ($find) break;
389 400
         }
390 401
         if (!$find){
391 402
             $find=$nodes[0];
@@ -435,7 +446,9 @@  discard block
 block discarded – undo
435 446
     public function getClusterInfoTable($cluster)
436 447
     {
437 448
         $this->connect();
438
-        if (empty($this->resultScan['cluster.list'][$cluster])) throw new QueryException('Cluster not find:' . $cluster);
449
+        if (empty($this->resultScan['cluster.list'][$cluster])) {
450
+            throw new QueryException('Cluster not find:' . $cluster);
451
+        }
439 452
         return $this->resultScan['cluster.list'][$cluster];
440 453
     }
441 454
 
@@ -474,8 +487,7 @@  discard block
 block discarded – undo
474 487
                 if ($resultDetail)
475 488
                 {
476 489
                     $list[$db_name.'.'.$table_name]=$nodes;
477
-                }
478
-                else
490
+                } else
479 491
                 {
480 492
                     $list[$db_name.'.'.$table_name]=array_keys($nodes);
481 493
                 }
@@ -557,13 +569,17 @@  discard block
 block discarded – undo
557 569
     {
558 570
         $list=$this->getTables(true);
559 571
 
560
-        if (empty($list[$database_table])) return [];
572
+        if (empty($list[$database_table])) {
573
+            return [];
574
+        }
561 575
 
562 576
 
563 577
         $result=[];
564 578
         foreach ($list[$database_table] as $node=>$row)
565 579
         {
566
-            if ($row['is_leader']) $result[]=$node;
580
+            if ($row['is_leader']) {
581
+                $result[]=$node;
582
+            }
567 583
         }
568 584
         return $result;
569 585
     }
Please login to merge, or discard this patch.
src/Settings.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -152,7 +152,9 @@
 block discarded – undo
152 152
      */
153 153
     public function getSessionId()
154 154
     {
155
-        if (empty($this->settings['session_id'])) return false;
155
+        if (empty($this->settings['session_id'])) {
156
+            return false;
157
+        }
156 158
         return $this->get('session_id');
157 159
     }
158 160
 
Please login to merge, or discard this patch.
doc/article_01_bigtable.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -68,7 +68,9 @@
 block discarded – undo
68 68
             'utm' => $userEvent->getUtm(),
69 69
         ];
70 70
         file_put_contents($fileName, \ClickHouseDB\FormatLine::TSV($row) . "\n", FILE_APPEND);
71
-        if ($z % 100 == 0) echo "$z\r";
71
+        if ($z % 100 == 0) {
72
+            echo "$z\r";
73
+        }
72 74
     }
73 75
 
74 76
 
Please login to merge, or discard this patch.