Passed
Push — master ( fdf013...12bd2a )
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/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/Http.php 2 patches
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.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -120,10 +120,10 @@  discard block
 block discarded – undo
120 120
             $proto = 'https';
121 121
         }
122 122
         $uri = $proto . '://' . $this->_host;
123
-        if (stripos($this->_host,'/')!==false || stripos($this->_host,':')!==false) {
123
+        if (stripos($this->_host, '/') !== false || stripos($this->_host, ':') !== false) {
124 124
             return $uri;
125 125
         }
126
-        if (intval($this->_port)>0) {
126
+        if (intval($this->_port) > 0) {
127 127
             return $uri . ':' . $this->_port;
128 128
         }
129 129
         return $uri;
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
         }
196 196
 
197 197
         $new->timeOut($this->settings()->getTimeOut());
198
-        $new->connectTimeOut($this->_connectTimeOut);//->keepAlive(); // one sec
198
+        $new->connectTimeOut($this->_connectTimeOut); //->keepAlive(); // one sec
199 199
         $new->verbose(boolval($this->_verbose));
200 200
 
201 201
         return $new;
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
     {
249 249
 
250 250
         if ($sql instanceof Query) {
251
-            $query=$sql;
251
+            $query = $sql;
252 252
         } else {
253 253
             $query = new Query($sql);
254 254
         }
@@ -610,10 +610,10 @@  discard block
 block discarded – undo
610 610
      * @return Statement
611 611
      * @throws \ClickHouseDB\Exception\TransportException
612 612
      */
613
-    private function streaming(Stream $streamRW,CurlerRequest $request)
613
+    private function streaming(Stream $streamRW, CurlerRequest $request)
614 614
     {
615
-        $callable=$streamRW->getClosure();
616
-        $stream=$streamRW->getStream();
615
+        $callable = $streamRW->getClosure();
616
+        $stream = $streamRW->getStream();
617 617
 
618 618
 
619 619
 
@@ -624,11 +624,11 @@  discard block
 block discarded – undo
624 624
                 if ($streamRW->isWrite())
625 625
                 {
626 626
 
627
-                    $callable = function ($ch, $fd, $length) use ($stream) {
627
+                    $callable = function($ch, $fd, $length) use ($stream) {
628 628
                         return ($line = fread($stream, $length)) ? $line : '';
629 629
                     };
630 630
                 } else {
631
-                    $callable = function ($ch, $fd) use ($stream) {
631
+                    $callable = function($ch, $fd) use ($stream) {
632 632
                         return fwrite($stream, $fd);
633 633
                     };
634 634
                 }
@@ -663,7 +663,7 @@  discard block
 block discarded – undo
663 663
             }
664 664
 
665 665
 
666
-            $this->_curler->execOne($request,true);
666
+            $this->_curler->execOne($request, true);
667 667
             $response = new Statement($request);
668 668
             if ($response->isError()) {
669 669
                 $response->error();
@@ -685,11 +685,11 @@  discard block
 block discarded – undo
685 685
      * @return Statement
686 686
      * @throws \ClickHouseDB\Exception\TransportException
687 687
      */
688
-    public function streamRead(Stream $streamRead,$sql,$bindings=[])
688
+    public function streamRead(Stream $streamRead, $sql, $bindings = [])
689 689
     {
690
-        $sql=$this->prepareQuery($sql,$bindings);
691
-        $request=$this->getRequestRead($sql);
692
-        return $this->streaming($streamRead,$request);
690
+        $sql = $this->prepareQuery($sql, $bindings);
691
+        $request = $this->getRequestRead($sql);
692
+        return $this->streaming($streamRead, $request);
693 693
 
694 694
     }
695 695
 
@@ -700,10 +700,10 @@  discard block
 block discarded – undo
700 700
      * @return Statement
701 701
      * @throws \ClickHouseDB\Exception\TransportException
702 702
      */
703
-    public function streamWrite(Stream $streamWrite,$sql,$bindings=[])
703
+    public function streamWrite(Stream $streamWrite, $sql, $bindings = [])
704 704
     {
705
-        $sql=$this->prepareQuery($sql,$bindings);
705
+        $sql = $this->prepareQuery($sql, $bindings);
706 706
         $request = $this->writeStreamData($sql);
707
-        return $this->streaming($streamWrite,$request);
707
+        return $this->streaming($streamWrite, $request);
708 708
     }
709 709
 }
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.
src/Query/Degeneration/Bindings.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -56,10 +56,10 @@  discard block
 block discarded – undo
56 56
      * @param string $pattern
57 57
      * @return string
58 58
      */
59
-    public function compile_binds($sql, $binds,$pattern)
59
+    public function compile_binds($sql, $binds, $pattern)
60 60
     {
61 61
         return preg_replace_callback($pattern, function($m) use ($binds){
62
-            if(isset($binds[$m[1]])){ // If it exists in our array
62
+            if (isset($binds[$m[1]])) { // If it exists in our array
63 63
                 return $binds[$m[1]]; // Then replace it from our array
64 64
             }
65 65
 
@@ -75,14 +75,14 @@  discard block
 block discarded – undo
75 75
      */
76 76
     public function process($sql)
77 77
     {
78
-        $bindFormatted=[];
79
-        $bindRaw=[];
78
+        $bindFormatted = [];
79
+        $bindRaw = [];
80 80
         foreach ($this->bindings as $key => $value) {
81 81
             if (is_array($value)) {
82 82
                 $valueSet = implode(', ', $value);
83 83
 
84 84
                 $values = array_map(
85
-                    function ($value) {
85
+                    function($value) {
86 86
                         return ValueFormatter::formatValue($value);
87 87
                     },
88 88
                     $value
@@ -95,21 +95,21 @@  discard block
 block discarded – undo
95 95
             }
96 96
 
97 97
             if ($formattedParameter !== null) {
98
-                $bindFormatted[$key]=$formattedParameter;
98
+                $bindFormatted[$key] = $formattedParameter;
99 99
             }
100 100
 
101 101
             if ($valueSet !== null) {
102
-                $bindRaw[$key]=$valueSet;
102
+                $bindRaw[$key] = $valueSet;
103 103
             }
104 104
         }
105 105
 
106
-        for ($loop=0;$loop<2;$loop++)
106
+        for ($loop = 0; $loop < 2; $loop++)
107 107
         {
108 108
             // dipping in binds
109 109
             // example ['A' => '{B}' , 'B'=>':C','C'=>123]
110
-            $sql=$this->compile_binds($sql,$bindRaw,'#{([\w+]+)}#');
110
+            $sql = $this->compile_binds($sql, $bindRaw, '#{([\w+]+)}#');
111 111
         }
112
-        $sql=$this->compile_binds($sql,$bindFormatted,'#:([\w+]+)#');
112
+        $sql = $this->compile_binds($sql, $bindFormatted, '#:([\w+]+)#');
113 113
 
114 114
         return $sql;
115 115
     }
Please login to merge, or discard this patch.
src/Quote/StrictQuoteLine.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -80,8 +80,8 @@
 block discarded – undo
80 80
                 // Elements of the array - the numbers are formatted as usual, and the dates, dates-with-time, and lines are in
81 81
                 // single quotation marks with the same screening rules as above.
82 82
                 // as in the TabSeparated format, and then the resulting string is output in InsertRow in double quotes.
83
-                $value       = array_map(
84
-                    function ($v) use ($enclosure_esc, $encode_esc) {
83
+                $value = array_map(
84
+                    function($v) use ($enclosure_esc, $encode_esc) {
85 85
                         return is_string($v) ? $this->encodeString($v, $enclosure_esc, $encode_esc) : $v;
86 86
                     },
87 87
                     $value
Please login to merge, or discard this patch.
src/Transport/CurlerRequest.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
      */
238 238
     public function setWriteFunction($callback)
239 239
     {
240
-        $this->options[CURLOPT_WRITEFUNCTION]=$callback;
240
+        $this->options[CURLOPT_WRITEFUNCTION] = $callback;
241 241
     }
242 242
     /**
243 243
      * @param callable $callback
@@ -612,7 +612,7 @@  discard block
 block discarded – undo
612 612
      */
613 613
     public function response()
614 614
     {
615
-        if (! $this->response) {
615
+        if (!$this->response) {
616 616
             throw new \ClickHouseDB\Exception\TransportException('Can`t fetch response - is empty');
617 617
         }
618 618
 
@@ -708,7 +708,7 @@  discard block
 block discarded – undo
708 708
 
709 709
         if (!empty($curl_opt[CURLOPT_WRITEFUNCTION]))
710 710
         {
711
-            $curl_opt[CURLOPT_HEADER]=false;
711
+            $curl_opt[CURLOPT_HEADER] = false;
712 712
         }
713 713
 
714 714
         if ($this->resultFileHandle) {
Please login to merge, or discard this patch.