Passed
Push — master ( 7b4f81...84e0ca )
by Igor
03:22
created
src/Cluster.php 1 patch
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
                     $tables[$row['database']][$row['table']][$node] = $row;
278 278
                 }
279 279
                 $result['replicas'][$node] = $r;
280
-            }catch (\Exception $E) {
280
+            } catch (\Exception $E) {
281 281
                 $result['replicas'][$node] = false;
282 282
                 $badNodes[$node] = $E->getMessage();
283 283
                 $this->error[] = 'statementsReplicas:' . $E->getMessage();
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
                         ];
300 300
                 }
301 301
 
302
-            }catch (\Exception $E) {
302
+            } catch (\Exception $E) {
303 303
                 $result['clusters'][$node] = false;
304 304
 
305 305
                 $this->error[] = 'clusters:' . $E->getMessage();
Please login to merge, or discard this patch.
src/Query/Degeneration/Bindings.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -112,7 +112,7 @@
 block discarded – undo
112 112
                 $escapedValues = $this->escapeArray($value);
113 113
 
114 114
                 $escapedValues = array_map(
115
-                    function ($escapedValue) {
115
+                    function($escapedValue) {
116 116
                         if (is_string($escapedValue)) {
117 117
                             return $this->formatStringParameter($escapedValue);
118 118
                         }
Please login to merge, or discard this patch.
src/Client.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
src/Transport/StreamWrite.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@
 block discarded – undo
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);
Please login to merge, or discard this patch.
src/Transport/StreamInsert.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
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');
Please login to merge, or discard this patch.
src/Transport/CurlerResponse.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -293,7 +293,7 @@
 block discarded – undo
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();
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -293,8 +293,9 @@
 block discarded – undo
293 293
 
294 294
         if (stripos($format, 'json') !== false)
295 295
         {
296
-            if (stripos($format,'JSONEachRow')===false)
297
-            return $this->json();
296
+            if (stripos($format,'JSONEachRow')===false) {
297
+                        return $this->json();
298
+            }
298 299
         }
299 300
         return $this->body();
300 301
 
Please login to merge, or discard this patch.
src/Transport/CurlerRequest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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) {
Please login to merge, or discard this patch.
src/Transport/Http.php 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
     {
241 241
 
242 242
         if ($sql instanceof Query) {
243
-            $query=$sql;
243
+            $query = $sql;
244 244
         } else {
245 245
             $query = new Query($sql);
246 246
         }
@@ -590,10 +590,10 @@  discard block
 block discarded – undo
590 590
      * @return Statement
591 591
      * @throws \ClickHouseDB\Exception\TransportException
592 592
      */
593
-    private function streaming(Stream $streamRW,CurlerRequest $request)
593
+    private function streaming(Stream $streamRW, CurlerRequest $request)
594 594
     {
595
-        $callable=$streamRW->getClosure();
596
-        $stream=$streamRW->getStream();
595
+        $callable = $streamRW->getClosure();
596
+        $stream = $streamRW->getStream();
597 597
 
598 598
 
599 599
 
@@ -604,11 +604,11 @@  discard block
 block discarded – undo
604 604
                 if ($streamRW->isWrite())
605 605
                 {
606 606
 
607
-                    $callable = function ($ch, $fd, $length) use ($stream) {
607
+                    $callable = function($ch, $fd, $length) use ($stream) {
608 608
                         return ($line = fread($stream, $length)) ? $line : '';
609 609
                     };
610 610
                 } else {
611
-                    $callable = function ($ch, $fd) use ($stream) {
611
+                    $callable = function($ch, $fd) use ($stream) {
612 612
                         return fwrite($stream, $fd);
613 613
                     };
614 614
                 }
@@ -643,7 +643,7 @@  discard block
 block discarded – undo
643 643
             }
644 644
 
645 645
 
646
-            $this->_curler->execOne($request,true);
646
+            $this->_curler->execOne($request, true);
647 647
             $response = new Statement($request);
648 648
             if ($response->isError()) {
649 649
                 $response->error();
@@ -665,11 +665,11 @@  discard block
 block discarded – undo
665 665
      * @return Statement
666 666
      * @throws \ClickHouseDB\Exception\TransportException
667 667
      */
668
-    public function streamRead(Stream $streamRead,$sql,$bindings=[])
668
+    public function streamRead(Stream $streamRead, $sql, $bindings = [])
669 669
     {
670
-        $sql=$this->prepareQuery($sql,$bindings);
671
-        $request=$this->getRequestRead($sql);
672
-        return $this->streaming($streamRead,$request);
670
+        $sql = $this->prepareQuery($sql, $bindings);
671
+        $request = $this->getRequestRead($sql);
672
+        return $this->streaming($streamRead, $request);
673 673
 
674 674
     }
675 675
 
@@ -680,10 +680,10 @@  discard block
 block discarded – undo
680 680
      * @return Statement
681 681
      * @throws \ClickHouseDB\Exception\TransportException
682 682
      */
683
-    public function streamWrite(Stream $streamWrite,$sql,$bindings=[])
683
+    public function streamWrite(Stream $streamWrite, $sql, $bindings = [])
684 684
     {
685
-        $sql=$this->prepareQuery($sql,$bindings);
685
+        $sql = $this->prepareQuery($sql, $bindings);
686 686
         $request = $this->writeStreamData($sql);
687
-        return $this->streaming($streamWrite,$request);
687
+        return $this->streaming($streamWrite, $request);
688 688
     }
689 689
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -650,8 +650,9 @@
 block discarded – undo
650 650
             }
651 651
             return $response;
652 652
         } finally {
653
-            if ($streamRW->isWrite())
654
-            fclose($stream);
653
+            if ($streamRW->isWrite()) {
654
+                        fclose($stream);
655
+            }
655 656
         }
656 657
 
657 658
 
Please login to merge, or discard this patch.
src/Transport/Stream.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -15,11 +15,11 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
68 68
      */
69 69
     public function enableGzipHeader()
70 70
     {
71
-        $this->gzip=true;
71
+        $this->gzip = true;
72 72
     }
73 73
 
74 74
 }
Please login to merge, or discard this patch.