Passed
Push — master ( 94ffb8...e27b04 )
by Igor
02:11
created
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.
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.