Passed
Push — master ( ed7597...a0408c )
by Igor
04:10 queued 01:55
created
src/Transport/Http.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
     /**
62 62
      * @var bool
63 63
      */
64
-    private $xClickHouseProgress=false;
64
+    private $xClickHouseProgress = false;
65 65
 
66 66
     /**
67 67
      * Http constructor.
@@ -113,10 +113,10 @@  discard block
 block discarded – undo
113 113
      */
114 114
     public function getUri()
115 115
     {
116
-        $proto='http';
117
-        if ($this->settings()->isHttps()) $proto='https';
116
+        $proto = 'http';
117
+        if ($this->settings()->isHttps()) $proto = 'https';
118 118
 
119
-        return $proto.'://' . $this->_host . ':' . $this->_port;
119
+        return $proto . '://' . $this->_host . ':' . $this->_port;
120 120
     }
121 121
 
122 122
     /**
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
         }
186 186
 
187 187
         $new->timeOut($this->settings()->getTimeOut());
188
-        $new->connectTimeOut($this->_connectTimeOut)->keepAlive();// one sec
188
+        $new->connectTimeOut($this->_connectTimeOut)->keepAlive(); // one sec
189 189
         $new->verbose($this->_verbose);
190 190
 
191 191
         return $new;
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
         $request = $this->newRequest($extendinfo);
280 280
         $request->url($url);
281 281
 
282
-        $request->setCallbackFunction(function (CurlerRequest $request) {
282
+        $request->setCallbackFunction(function(CurlerRequest $request) {
283 283
             fclose($request->getInfileHandle());
284 284
         });
285 285
 
@@ -322,29 +322,29 @@  discard block
 block discarded – undo
322 322
 
323 323
     public function __findXClickHouseProgress($handle)
324 324
     {
325
-        $code=curl_getinfo($handle,CURLINFO_HTTP_CODE);
325
+        $code = curl_getinfo($handle, CURLINFO_HTTP_CODE);
326 326
 
327 327
         // Search X-ClickHouse-Progress
328
-        if ($code==200) {
328
+        if ($code == 200) {
329 329
             $response = curl_multi_getcontent($handle);
330 330
             $header_size = curl_getinfo($handle, CURLINFO_HEADER_SIZE);
331 331
             if (!$header_size) return false;
332 332
 
333 333
             $header = substr($response, 0, $header_size);
334 334
             if (!$header_size) return false;
335
-            $pos=strrpos($header,'X-ClickHouse-Progress');
335
+            $pos = strrpos($header, 'X-ClickHouse-Progress');
336 336
 
337 337
             if (!$pos) return false;
338 338
 
339
-            $last=substr($header,$pos);
340
-            $data=@json_decode(str_ireplace('X-ClickHouse-Progress:','',$last),true);
339
+            $last = substr($header, $pos);
340
+            $data = @json_decode(str_ireplace('X-ClickHouse-Progress:', '', $last), true);
341 341
 
342 342
             if ($data && is_callable($this->xClickHouseProgress)) {
343 343
 
344
-                if (is_array($this->xClickHouseProgress)){
345
-                    call_user_func_array($this->xClickHouseProgress,[$data]);
344
+                if (is_array($this->xClickHouseProgress)) {
345
+                    call_user_func_array($this->xClickHouseProgress, [$data]);
346 346
                 } else {
347
-                    call_user_func($this->xClickHouseProgress,$data);
347
+                    call_user_func($this->xClickHouseProgress, $data);
348 348
                 }
349 349
 
350 350
 
@@ -407,13 +407,13 @@  discard block
 block discarded – undo
407 407
             }
408 408
 
409 409
 
410
-            $request->setResultFileHandle($fout, $isGz)->setCallbackFunction(function (CurlerRequest $request) {
410
+            $request->setResultFileHandle($fout, $isGz)->setCallbackFunction(function(CurlerRequest $request) {
411 411
                 fclose($request->getResultFileHandle());
412 412
             });
413 413
         }
414 414
         if ($this->xClickHouseProgress)
415 415
         {
416
-            $request->setFunctionProgress([$this,'__findXClickHouseProgress']);
416
+            $request->setFunctionProgress([$this, '__findXClickHouseProgress']);
417 417
         }
418 418
         // ---------------------------------------------------------------------------------
419 419
         return $request;
@@ -541,7 +541,7 @@  discard block
 block discarded – undo
541 541
      */
542 542
     public function setProgressFunction(callable $callback)
543 543
     {
544
-        $this->xClickHouseProgress=$callback;
544
+        $this->xClickHouseProgress = $callback;
545 545
     }
546 546
 
547 547
     /**
Please login to merge, or discard this patch.
src/Query/Query.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -20,21 +20,21 @@  discard block
 block discarded – undo
20 20
     /**
21 21
      * @var array
22 22
      */
23
-    private $degenerations=[];
23
+    private $degenerations = [];
24 24
 
25 25
     /**
26 26
      * Query constructor.
27 27
      * @param $sql
28 28
      * @param array $degenerations
29 29
      */
30
-    public function __construct($sql,$degenerations=[])
30
+    public function __construct($sql, $degenerations = [])
31 31
     {
32 32
         if (!trim($sql))
33 33
         {
34 34
             throw new QueryException('Empty Query');
35 35
         }
36 36
         $this->sql = $sql;
37
-        $this->degenerations=$degenerations;
37
+        $this->degenerations = $degenerations;
38 38
     }
39 39
 
40 40
     /**
@@ -50,17 +50,17 @@  discard block
 block discarded – undo
50 50
     {
51 51
         // FORMAT\s(\w)*$
52 52
         if (null === $this->format) return false;
53
-        $supportFormats=
53
+        $supportFormats =
54 54
             "FORMAT\\s+TSV|FORMAT\\s+TSVRaw|FORMAT\\s+TSVWithNames|FORMAT\\s+TSVWithNamesAndTypes|FORMAT\\s+Vertical|FORMAT\\s+JSONCompact|FORMAT\\s+JSONEachRow|FORMAT\\s+TSKV|FORMAT\\s+TabSeparatedWithNames|FORMAT\\s+TabSeparatedWithNamesAndTypes|FORMAT\\s+TabSeparatedRaw|FORMAT\\s+BlockTabSeparated|FORMAT\\s+CSVWithNames|FORMAT\\s+CSV|FORMAT\\s+JSON|FORMAT\\s+TabSeparated";
55 55
 
56
-        $matches=[];
57
-        if (preg_match_all('%('.$supportFormats.')%ius',$this->sql,$matches)){
56
+        $matches = [];
57
+        if (preg_match_all('%(' . $supportFormats . ')%ius', $this->sql, $matches)) {
58 58
 
59 59
             // skip add "format json"
60 60
             if (isset($matches[0]))
61 61
             {
62
-                $format=trim(str_ireplace('format','',$matches[0][0]));
63
-                $this->format=$format;
62
+                $format = trim(str_ireplace('format', '', $matches[0][0]));
63
+                $this->format = $format;
64 64
 
65 65
             }
66 66
         }
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
             foreach ($this->degenerations as $degeneration)
92 92
             {
93 93
                 if ($degeneration instanceof Degeneration) {
94
-                    $this->sql=$degeneration->process($this->sql);
94
+                    $this->sql = $degeneration->process($this->sql);
95 95
                 }
96 96
             }
97 97
         }
Please login to merge, or discard this patch.