Completed
Push — master ( 4f9fcc...6c92c6 )
by Igor
06:44
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/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/Query/Degeneration/Conditions.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@
 block discarded – undo
75 75
         $markers = $this->bindings;
76 76
 
77 77
         // ------ if/else conditions & if[set|int]/else conditions -----
78
-        $sql = preg_replace_callback('#\{if(.{0,}?)\s+([^\}]+?)\}(.+?)(\{else\}([^\{]+?)?)?\s*\{\/if}#sui', function ($matches) use ($markers) {
78
+        $sql = preg_replace_callback('#\{if(.{0,}?)\s+([^\}]+?)\}(.+?)(\{else\}([^\{]+?)?)?\s*\{\/if}#sui', function($matches) use ($markers) {
79 79
             return self::__ifsets($matches, $markers);
80 80
         }
81 81
             , $sql);
Please login to merge, or discard this patch.
src/Statement.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
     /**
84 84
      * @var int
85 85
      */
86
-    public $iterator=0;
86
+    public $iterator = 0;
87 87
 
88 88
 
89 89
     public function __construct(CurlerRequest $request)
@@ -221,15 +221,15 @@  discard block
 block discarded – undo
221 221
             $this->_init = true;
222 222
             return false;
223 223
         }
224
-        $data=[];
224
+        $data = [];
225 225
         foreach (['meta', 'data', 'totals', 'extremes', 'rows', 'rows_before_limit_at_least', 'statistics'] as $key) {
226 226
 
227 227
             if (isset($this->_rawData[$key])) {
228
-                if ($key=='data')
228
+                if ($key == 'data')
229 229
                 {
230
-                    $data=$this->_rawData[$key];
230
+                    $data = $this->_rawData[$key];
231 231
                 }
232
-                else{
232
+                else {
233 233
                     $this->{$key} = $this->_rawData[$key];
234 234
                 }
235 235
 
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
             throw  new QueryException('Can`t find meta');
241 241
         }
242 242
 
243
-        $isJSONCompact=(stripos($this->format,'JSONCompact')!==false?true:false);
243
+        $isJSONCompact = (stripos($this->format, 'JSONCompact') !== false ?true:false);
244 244
         $this->array_data = [];
245 245
         foreach ($data as $rows) {
246 246
             $r = [];
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 
249 249
             if ($isJSONCompact)
250 250
             {
251
-                $r[]=$rows;
251
+                $r[] = $rows;
252 252
             }
253 253
             else {
254 254
                 foreach ($this->meta as $meta) {
@@ -404,14 +404,14 @@  discard block
 block discarded – undo
404 404
      */
405 405
     public function resetIterator()
406 406
     {
407
-        $this->iterator=0;
407
+        $this->iterator = 0;
408 408
     }
409 409
 
410 410
     public function fetchRow($key = null)
411 411
     {
412 412
         $this->init();
413 413
 
414
-        $position=$this->iterator;
414
+        $position = $this->iterator;
415 415
 
416 416
         if (!isset($this->array_data[$position])) {
417 417
             return null;
Please login to merge, or discard this patch.
Braces   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -228,8 +228,7 @@  discard block
 block discarded – undo
228 228
                 if ($key=='data')
229 229
                 {
230 230
                     $data=$this->_rawData[$key];
231
-                }
232
-                else{
231
+                } else{
233 232
                     $this->{$key} = $this->_rawData[$key];
234 233
                 }
235 234
 
@@ -249,8 +248,7 @@  discard block
 block discarded – undo
249 248
             if ($isJSONCompact)
250 249
             {
251 250
                 $r[]=$rows;
252
-            }
253
-            else {
251
+            } else {
254 252
                 foreach ($this->meta as $meta) {
255 253
                     $r[$meta['name']] = $rows[$meta['name']];
256 254
                 }
@@ -364,7 +362,9 @@  discard block
 block discarded – undo
364 362
             return null;
365 363
         }
366 364
 
367
-        if (!$key) return $this->statistics;
365
+        if (!$key) {
366
+            return $this->statistics;
367
+        }
368 368
 
369 369
         if (!isset($this->statistics[$key])) {
370 370
             return null;
Please login to merge, or discard this patch.
src/Client.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
      */
319 319
     public function enableLogQueries(bool $flag = true)
320 320
     {
321
-        $this->settings()->set('log_queries', (int)$flag);
321
+        $this->settings()->set('log_queries', (int) $flag);
322 322
 
323 323
         return $this;
324 324
     }
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
      */
355 355
     public function enableExtremes(bool $flag = true)
356 356
     {
357
-        $this->settings()->set('extremes', (int)$flag);
357
+        $this->settings()->set('extremes', (int) $flag);
358 358
 
359 359
         return $this;
360 360
     }
@@ -778,7 +778,7 @@  discard block
 block discarded – undo
778 778
     public function partitions(string $table, int $limit = null, bool $active = null)
779 779
     {
780 780
         $database = $this->settings()->getDatabase();
781
-        $whereActiveClause = $active === null ? '' : sprintf(' AND active = %s', (int)$active);
781
+        $whereActiveClause = $active === null ? '' : sprintf(' AND active = %s', (int) $active);
782 782
         $limitClause = $limit !== null ? ' LIMIT ' . $limit : '';
783 783
 
784 784
         return $this->select(<<<CLICKHOUSE
@@ -842,7 +842,7 @@  discard block
 block discarded – undo
842 842
      */
843 843
     public function getServerVersion(): string
844 844
     {
845
-        return (string)$this->select('SELECT version() as version')->fetchOne('version');
845
+        return (string) $this->select('SELECT version() as version')->fetchOne('version');
846 846
     }
847 847
 
848 848
     /**
Please login to merge, or discard this patch.