Completed
Pull Request — master (#1)
by Romain
02:07
created
src/Queries/Snippets/Set.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,13 +33,13 @@
 block discarded – undo
33 33
 
34 34
     public function toString(): string
35 35
     {
36
-        if(empty($this->sets))
36
+        if (empty($this->sets))
37 37
         {
38 38
             return '';
39 39
         }
40 40
 
41 41
         $sets = array();
42
-        foreach($this->sets as $columnName => $value)
42
+        foreach ($this->sets as $columnName => $value)
43 43
         {
44 44
             $type = $this->guessType($columnName, $value);
45 45
 
Please login to merge, or discard this patch.
src/Queries/Snippets/Values.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
     {
23 23
         $this->values = [];
24 24
 
25
-        if(! empty($values))
25
+        if (!empty($values))
26 26
         {
27 27
             $this->values($values);
28 28
         }
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 
38 38
     public function toString(): string
39 39
     {
40
-        if(empty($this->values))
40
+        if (empty($this->values))
41 41
         {
42 42
             throw new \RuntimeException('No values to insert');
43 43
         }
@@ -46,9 +46,9 @@  discard block
 block discarded – undo
46 46
 
47 47
         $values = [];
48 48
 
49
-        foreach($this->values as $valuesSet)
49
+        foreach ($this->values as $valuesSet)
50 50
         {
51
-            if($columnsNameList !== array_keys($valuesSet))
51
+            if ($columnsNameList !== array_keys($valuesSet))
52 52
             {
53 53
                 throw new \RuntimeException('Cannot insert different schema on the same table.');
54 54
             }
@@ -67,9 +67,9 @@  discard block
 block discarded – undo
67 67
     {
68 68
         $valuesSet = [];
69 69
 
70
-        foreach($values as $columnName => $value)
70
+        foreach ($values as $columnName => $value)
71 71
         {
72
-            if(! empty($columnName))
72
+            if (!empty($columnName))
73 73
             {
74 74
                 $type = $this->guessType($columnName, $value);
75 75
 
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 
83 83
     private function formatValue(Type $type, $value)
84 84
     {
85
-        if(is_null($value))
85
+        if (is_null($value))
86 86
         {
87 87
             return 'NULL';
88 88
         }
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
     {
95 95
         $value = $type->format($value);
96 96
 
97
-        if($type->isEscapeRequired())
97
+        if ($type->isEscapeRequired())
98 98
         {
99 99
             $value = $this->escaper->escape($value);
100 100
         }
Please login to merge, or discard this patch.
src/Queries/Snippets/Builders/GroupBy.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
     protected
10 10
         $groupBy;
11 11
 
12
-    public function groupBy(?string $column): self
12
+    public function groupBy(? string $column) : self
13 13
     {
14 14
         $this->groupBy->addGroupBy($column);
15 15
 
Please login to merge, or discard this patch.
src/Queries/Snippets/Builders/Limit.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
      */
28 28
     public function offset($offset): self
29 29
     {
30
-        if(!$this->limit instanceof Snippets\Limit)
30
+        if (!$this->limit instanceof Snippets\Limit)
31 31
         {
32 32
             throw new \LogicException('LIMIT is required to define OFFSET.');
33 33
         }
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
         $limit = $this->buildLimitClause();
43 43
 
44 44
         $offset = '';
45
-        if(! empty($limit))
45
+        if (!empty($limit))
46 46
         {
47 47
             $offset = $this->buildOffsetClause();
48 48
         }
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 
55 55
     private function buildLimitClause(): string
56 56
     {
57
-        if($this->limit instanceof Snippets\Limit)
57
+        if ($this->limit instanceof Snippets\Limit)
58 58
         {
59 59
             return $this->limit->toString();
60 60
         }
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 
65 65
     private function buildOffsetClause(): string
66 66
     {
67
-        if($this->offset instanceof Snippets\Offset)
67
+        if ($this->offset instanceof Snippets\Offset)
68 68
         {
69 69
             return $this->offset->toString();
70 70
         }
Please login to merge, or discard this patch.
src/Queries/Snippets/Builders/Join.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -11,21 +11,21 @@  discard block
 block discarded – undo
11 11
     protected
12 12
         $joins = array();
13 13
 
14
-    public function innerJoin(string $table, ?string $alias = null): self
14
+    public function innerJoin(string $table, ? string $alias = null) : self
15 15
     {
16 16
         $this->joins[] = new Snippets\Joins\InnerJoin($table, $alias);
17 17
 
18 18
         return $this;
19 19
     }
20 20
 
21
-    public function leftJoin(string $table, ?string $alias = null): self
21
+    public function leftJoin(string $table, ? string $alias = null) : self
22 22
     {
23 23
         $this->joins[] = new Snippets\Joins\LeftJoin($table, $alias);
24 24
 
25 25
         return $this;
26 26
     }
27 27
 
28
-    public function rightJoin(string $table, ?string $alias = null): self
28
+    public function rightJoin(string $table, ? string $alias = null) : self
29 29
     {
30 30
         $this->joins[] = new Snippets\Joins\RightJoin($table, $alias);
31 31
 
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
     {
56 56
         $joins = [];
57 57
 
58
-        foreach($this->joins as $innerJoin)
58
+        foreach ($this->joins as $innerJoin)
59 59
         {
60 60
             $joins[] = $innerJoin->toString();
61 61
         }
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
     {
68 68
         $lastJoins = end($this->joins);
69 69
 
70
-        if(! $lastJoins instanceof Snippets\Join)
70
+        if (!$lastJoins instanceof Snippets\Join)
71 71
         {
72 72
             throw new \LogicException('Erreur dans la récupération de la dernière jointure');
73 73
         }
Please login to merge, or discard this patch.
src/Queries/Snippets/Offset.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 
25 25
     public function toString(): string
26 26
     {
27
-        if(is_null($this->offset))
27
+        if (is_null($this->offset))
28 28
         {
29 29
             return '';
30 30
         }
@@ -35,14 +35,14 @@  discard block
 block discarded – undo
35 35
         );
36 36
     }
37 37
 
38
-    private function convertToInteger($value): ?int
38
+    private function convertToInteger($value): ? int
39 39
     {
40
-        if($this->isConvertibleToString($value) === false)
40
+        if ($this->isConvertibleToString($value) === false)
41 41
         {
42 42
             throw new \InvalidArgumentException("Offset argument must be an integer or an integer wrapped into a string");
43 43
         }
44 44
 
45
-        if(preg_match('~^[\d]+$~', (string) $value))
45
+        if (preg_match('~^[\d]+$~', (string) $value))
46 46
         {
47 47
             return (int) $value;
48 48
         }
Please login to merge, or discard this patch.
src/Queries/Snippets/On.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
         $leftColumn,
13 13
         $rightColumn;
14 14
 
15
-    public function __construct(?string $leftColumn, ?string $rightColumn)
15
+    public function __construct(? string $leftColumn, ? string $rightColumn)
16 16
     {
17 17
         $this->leftColumn = (string) $leftColumn;
18 18
         $this->rightColumn = (string) $rightColumn;
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 
21 21
     public function toString(): string
22 22
     {
23
-        if(empty($this->leftColumn) || empty($this->rightColumn))
23
+        if (empty($this->leftColumn) || empty($this->rightColumn))
24 24
         {
25 25
             return '';
26 26
         }
Please login to merge, or discard this patch.
src/Queries/Snippets/Count.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -15,9 +15,9 @@  discard block
 block discarded – undo
15 15
     /**
16 16
      * @param Snippet|string $columnName
17 17
      */
18
-    public function __construct($columnName, ?string $alias = null)
18
+    public function __construct($columnName, ? string $alias = null)
19 19
     {
20
-        if((! $columnName instanceof Snippet) && empty($columnName))
20
+        if ((!$columnName instanceof Snippet) && empty($columnName))
21 21
         {
22 22
             throw new \InvalidArgumentException('Empty column name.');
23 23
         }
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
     {
39 39
         $columnName = $this->columnName;
40 40
 
41
-        if($columnName instanceof Snippet)
41
+        if ($columnName instanceof Snippet)
42 42
         {
43 43
             $columnName = $columnName->toString();
44 44
         }
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
     {
51 51
         $alias = $this->alias;
52 52
 
53
-        if(! empty($alias))
53
+        if (!empty($alias))
54 54
         {
55 55
             return sprintf('AS %s', $alias);
56 56
         }
Please login to merge, or discard this patch.
src/Queries/Snippets/Distinct.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,9 +11,9 @@
 block discarded – undo
11 11
     private
12 12
         $columnName;
13 13
 
14
-    public function __construct(?string $columnName)
14
+    public function __construct(? string $columnName)
15 15
     {
16
-        if(empty($columnName))
16
+        if (empty($columnName))
17 17
         {
18 18
             throw new \InvalidArgumentException('Empty column name.');
19 19
         }
Please login to merge, or discard this patch.