Passed
Pull Request — master (#57)
by Šimon
02:16
created
src/Query/Query.php 2 patches
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -48,7 +48,9 @@  discard block
 block discarded – undo
48 48
     private function applyFormatQuery()
49 49
     {
50 50
         // FORMAT\s(\w)*$
51
-        if (null === $this->format) return false;
51
+        if (null === $this->format) {
52
+            return false;
53
+        }
52 54
         $supportFormats=
53 55
             "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";
54 56
 
@@ -62,8 +64,7 @@  discard block
 block discarded – undo
62 64
                 $this->format=$format;
63 65
 
64 66
             }
65
-        }
66
-        else {
67
+        } else {
67 68
             $this->sql = $this->sql . ' FORMAT ' . $this->format;
68 69
         }
69 70
 
Please login to merge, or discard this 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.