Passed
Push — master ( 4c2c3a...7a13fc )
by Igor
03:32
created
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.
example/Helper.php 1 patch
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -123,8 +123,10 @@
 block discarded – undo
123 123
 
124 124
         for ($day_ago = 0; $day_ago < 360; $day_ago++) {
125 125
             $date = strtotime('-' . $day_ago . ' day');
126
-            for ($hash_id = 1; $hash_id < (1 + $size); $hash_id++)
127
-                for ($site_id = 100; $site_id < 199; $site_id++) {
126
+            for ($hash_id = 1; $hash_id < (1 + $size); $hash_id++) {
127
+                            for ($site_id = 100;
128
+            }
129
+            $site_id < 199; $site_id++) {
128 130
                     $j['event_time'] = date('Y-m-d H:00:00', $date);
129 131
                     $j['site_id'] = $site_id;
130 132
                     $j['hash_id'] = $hash_id;
Please login to merge, or discard this patch.
src/Query/Query.php 1 patch
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -49,7 +49,9 @@  discard block
 block discarded – undo
49 49
     private function applyFormatQuery()
50 50
     {
51 51
         // FORMAT\s(\w)*$
52
-        if (null === $this->format) return false;
52
+        if (null === $this->format) {
53
+            return false;
54
+        }
53 55
         $supportFormats=
54 56
             "FORMAT\\s+TSV|FORMAT\\s+TSVRaw|FORMAT\\s+TSVWithNames|FORMAT\\s+TSVWithNamesAndTypes|FORMAT\\s+Vertical|FORMAT\\s+JSONCompact|FORMAT\\s+JSONEachRow|FORMAT\\s+TSKV|FORMAT\\s+TabSeparatedWithNames|FORMAT\\s+TabSeparatedWithNamesAndTypes|FORMAT\\s+TabSeparatedRaw|FORMAT\\s+BlockTabSeparated|FORMAT\\s+CSVWithNames|FORMAT\\s+CSV|FORMAT\\s+JSON|FORMAT\\s+TabSeparated";
55 57
 
@@ -63,8 +65,7 @@  discard block
 block discarded – undo
63 65
                 $this->format=trim(str_ireplace('format','',$matches[0][0]));
64 66
 
65 67
             }
66
-        }
67
-        else {
68
+        } else {
68 69
             $this->sql = $this->sql . ' FORMAT ' . $this->format;
69 70
         }
70 71
 
Please login to merge, or discard this patch.
src/Statement.php 1 patch
Braces   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -167,13 +167,11 @@  discard block
 block discarded – undo
167 167
 
168 168
             if ($parse) {
169 169
                 throw new DatabaseException($parse['message'] . "\nIN:" . $this->sql(), $parse['code']);
170
-            }
171
-            else {
170
+            } else {
172 171
                 $code = $this->response()->http_code();
173 172
                 $message = "HttpCode:" . $this->response()->http_code() . " ; ".$this->response()->error()." ;" . $body;
174 173
             }
175
-        }
176
-        else {
174
+        } else {
177 175
             $code = $error_no;
178 176
             $message = $this->response()->error();
179 177
         }
@@ -349,8 +347,12 @@  discard block
 block discarded – undo
349 347
         $this->init();
350 348
         if ($key)
351 349
         {
352
-            if (!is_array($this->statistics)) return null;
353
-            if (!isset($this->statistics[$key])) return null;
350
+            if (!is_array($this->statistics)) {
351
+                return null;
352
+            }
353
+            if (!isset($this->statistics[$key])) {
354
+                return null;
355
+            }
354 356
             return $this->statistics[$key];
355 357
         }
356 358
         return $this->statistics;
@@ -394,8 +396,7 @@  discard block
 block discarded – undo
394 396
             if ($key) {
395 397
                 if (isset($this->array_data[0][$key])) {
396 398
                     return $this->array_data[0][$key];
397
-                }
398
-                else {
399
+                } else {
399 400
                     return null;
400 401
                 }
401 402
             }
@@ -489,16 +490,14 @@  discard block
 block discarded – undo
489 490
     {
490 491
         if (is_array($path)) {
491 492
             $keys = $path;
492
-        }
493
-        else {
493
+        } else {
494 494
             $args = func_get_args();
495 495
             array_shift($args);
496 496
 
497 497
             if (sizeof($args) < 2) {
498 498
                 $separator = '.';
499 499
                 $keys = explode($separator, $path);
500
-            }
501
-            else {
500
+            } else {
502 501
                 $keys = $args;
503 502
             }
504 503
         }
@@ -510,14 +509,15 @@  discard block
 block discarded – undo
510 509
 
511 510
             if (isset($arr[$key])) {
512 511
                 $val = $arr[$key];
513
-            }
514
-            else {
512
+            } else {
515 513
                 $val = $key;
516 514
             }
517 515
 
518 516
             $tree = array($val => $tree);
519 517
         }
520
-        if (!is_array($tree)) return [];
518
+        if (!is_array($tree)) {
519
+            return [];
520
+        }
521 521
         return $tree;
522 522
     }
523 523
 }
Please login to merge, or discard this patch.
src/Settings.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -47,7 +47,9 @@  discard block
 block discarded – undo
47 47
      */
48 48
     public function get($key)
49 49
     {
50
-        if (!$this->is($key)) return null;
50
+        if (!$this->is($key)) {
51
+            return null;
52
+        }
51 53
         return $this->settings[$key];
52 54
     }
53 55
 
@@ -153,7 +155,9 @@  discard block
 block discarded – undo
153 155
      */
154 156
     public function getSessionId()
155 157
     {
156
-        if (empty($this->settings['session_id'])) return false;
158
+        if (empty($this->settings['session_id'])) {
159
+            return false;
160
+        }
157 161
         return $this->get('session_id');
158 162
     }
159 163
 
Please login to merge, or discard this patch.