Passed
Push — master ( afce37...5f7fa6 )
by Igor
02:17
created
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 1 patch
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.
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/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 1 patch
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.
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.
src/Transport/Http.php 1 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/Query/Degeneration/Bindings.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -64,10 +64,10 @@  discard block
 block discarded – undo
64 64
      * @param string $pattern
65 65
      * @return string
66 66
      */
67
-    public function compile_binds($sql, $binds,$pattern)
67
+    public function compile_binds($sql, $binds, $pattern)
68 68
     {
69 69
         return preg_replace_callback($pattern, function($m) use ($binds){
70
-            if(isset($binds[$m[1]])){ // If it exists in our array
70
+            if (isset($binds[$m[1]])) { // If it exists in our array
71 71
                 return $binds[$m[1]]; // Then replace it from our array
72 72
             }
73 73
 
@@ -83,14 +83,14 @@  discard block
 block discarded – undo
83 83
      */
84 84
     public function process($sql)
85 85
     {
86
-        $bindFormatted=[];
87
-        $bindRaw=[];
86
+        $bindFormatted = [];
87
+        $bindRaw = [];
88 88
         foreach ($this->bindings as $key => $value) {
89 89
             if (is_array($value)) {
90 90
                 $valueSet = implode(', ', $value);
91 91
 
92 92
                 $values = array_map(
93
-                    function ($value) {
93
+                    function($value) {
94 94
                         return $this->formatParameter($value);
95 95
                     },
96 96
                     $value
@@ -103,21 +103,21 @@  discard block
 block discarded – undo
103 103
             }
104 104
 
105 105
             if ($formattedParameter !== null) {
106
-                $bindFormatted[$key]=$formattedParameter;
106
+                $bindFormatted[$key] = $formattedParameter;
107 107
             }
108 108
 
109 109
             if ($valueSet !== null) {
110
-                $bindRaw[$key]=$valueSet;
110
+                $bindRaw[$key] = $valueSet;
111 111
             }
112 112
         }
113 113
 
114
-        for ($loop=0;$loop<2;$loop++)
114
+        for ($loop = 0; $loop < 2; $loop++)
115 115
         {
116 116
             // dipping in binds
117 117
             // example ['A' => '{B}' , 'B'=>':C','C'=>123]
118
-            $sql=$this->compile_binds($sql,$bindRaw,'#{([\w+]+)}#');
118
+            $sql = $this->compile_binds($sql, $bindRaw, '#{([\w+]+)}#');
119 119
         }
120
-        $sql=$this->compile_binds($sql,$bindFormatted,'#:([\w+]+)#');
120
+        $sql = $this->compile_binds($sql, $bindFormatted, '#:([\w+]+)#');
121 121
 
122 122
         return $sql;
123 123
     }
Please login to merge, or discard this patch.