Passed
Pull Request — master (#99)
by Šimon
07:10 queued 05:11
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/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
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   +16 added lines, -16 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;
@@ -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/Statement.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -219,15 +219,15 @@  discard block
 block discarded – undo
219 219
             $this->_init = true;
220 220
             return false;
221 221
         }
222
-        $data=[];
222
+        $data = [];
223 223
         foreach (['meta', 'data', 'totals', 'extremes', 'rows', 'rows_before_limit_at_least', 'statistics'] as $key) {
224 224
 
225 225
             if (isset($this->_rawData[$key])) {
226
-                if ($key=='data')
226
+                if ($key == 'data')
227 227
                 {
228
-                    $data=$this->_rawData[$key];
228
+                    $data = $this->_rawData[$key];
229 229
                 }
230
-                else{
230
+                else {
231 231
                     $this->{$key} = $this->_rawData[$key];
232 232
                 }
233 233
 
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
             throw  new QueryException('Can`t find meta');
239 239
         }
240 240
 
241
-        $isJSONCompact=(stripos($this->format,'JSONCompact')!==false?true:false);
241
+        $isJSONCompact = (stripos($this->format, 'JSONCompact') !== false ?true:false);
242 242
         $this->array_data = [];
243 243
         foreach ($data as $rows) {
244 244
             $r = [];
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 
247 247
             if ($isJSONCompact)
248 248
             {
249
-                $r[]=$rows;
249
+                $r[] = $rows;
250 250
             }
251 251
             else {
252 252
                 foreach ($this->meta as $meta) {
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -226,8 +226,7 @@  discard block
 block discarded – undo
226 226
                 if ($key=='data')
227 227
                 {
228 228
                     $data=$this->_rawData[$key];
229
-                }
230
-                else{
229
+                } else{
231 230
                     $this->{$key} = $this->_rawData[$key];
232 231
                 }
233 232
 
@@ -247,8 +246,7 @@  discard block
 block discarded – undo
247 246
             if ($isJSONCompact)
248 247
             {
249 248
                 $r[]=$rows;
250
-            }
251
-            else {
249
+            } else {
252 250
                 foreach ($this->meta as $meta) {
253 251
                     $r[$meta['name']] = $rows[$meta['name']];
254 252
                 }
Please login to merge, or discard this patch.
src/Transport/CurlerRolling.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
     public function execLoopWait()
145 145
     {
146 146
         $c = 0;
147
-        $count=0;
147
+        $count = 0;
148 148
         // add all tasks
149 149
         do {
150 150
             $this->exec();
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
             $loop = $this->countActive();
153 153
             $pend = $this->countPending();
154 154
 
155
-            $count=$loop+$pend;
155
+            $count = $loop + $pend;
156 156
             $c++;
157 157
 
158 158
             if ($c > 20000) {
Please login to merge, or discard this patch.