Completed
Pull Request — master (#1)
by Romain
02:07
created
src/Queries/Snippets/Update.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -11,19 +11,19 @@  discard block
 block discarded – undo
11 11
     private
12 12
         $tables;
13 13
 
14
-    public function __construct($table = null, ?string $alias = null)
14
+    public function __construct($table = null, ? string $alias = null)
15 15
     {
16 16
         $this->tables = array();
17 17
 
18
-        if(! empty($table))
18
+        if (!empty($table))
19 19
         {
20 20
             $this->addTable($table, $alias);
21 21
         }
22 22
     }
23 23
 
24
-    public function addTable($table, ?string $alias = null): self
24
+    public function addTable($table, ? string $alias = null) : self
25 25
     {
26
-        if(! $table instanceof TableName)
26
+        if (!$table instanceof TableName)
27 27
         {
28 28
             $table = new TableName($table, $alias);
29 29
         }
@@ -35,14 +35,14 @@  discard block
 block discarded – undo
35 35
 
36 36
     public function toString(): string
37 37
     {
38
-        if(empty($this->tables))
38
+        if (empty($this->tables))
39 39
         {
40 40
             return '';
41 41
         }
42 42
 
43 43
         $tables = array();
44 44
 
45
-        foreach($this->tables as $table)
45
+        foreach ($this->tables as $table)
46 46
         {
47 47
             $tables[] = $table->toString();
48 48
         }
@@ -54,9 +54,9 @@  discard block
 block discarded – undo
54 54
 
55 55
     public function hasNeededTable(string $tableName): bool
56 56
     {
57
-        foreach($this->tables as $table)
57
+        foreach ($this->tables as $table)
58 58
         {
59
-            if($table->getName() === $tableName || $table->getAlias() === $tableName)
59
+            if ($table->getName() === $tableName || $table->getAlias() === $tableName)
60 60
             {
61 61
                 return true;
62 62
             }
Please login to merge, or discard this patch.
src/Queries/Snippets/Builders/QueryPart.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 
22 22
     public function needTable($tableName): Query
23 23
     {
24
-        if(! in_array($tableName, $this->neededTableNames))
24
+        if (!in_array($tableName, $this->neededTableNames))
25 25
         {
26 26
             $this->neededTableNames[] = $tableName;
27 27
         }
@@ -31,9 +31,9 @@  discard block
 block discarded – undo
31 31
 
32 32
     public function ensureNeededTablesArePresent(array $snippets): void
33 33
     {
34
-        foreach($this->neededTableNames as $tableName)
34
+        foreach ($this->neededTableNames as $tableName)
35 35
         {
36
-            if(! $this->isAtLeastOneSnippetHasNeededTable($tableName, $snippets))
36
+            if (!$this->isAtLeastOneSnippetHasNeededTable($tableName, $snippets))
37 37
             {
38 38
                 throw new \LogicException("One of query parts you used needs $tableName table");
39 39
             }
@@ -42,14 +42,14 @@  discard block
 block discarded – undo
42 42
 
43 43
     private function isAtLeastOneSnippetHasNeededTable($tableName, array $snippets): bool
44 44
     {
45
-        foreach($snippets as $snippet)
45
+        foreach ($snippets as $snippet)
46 46
         {
47
-            if(! $snippet instanceof NeedTableAware)
47
+            if (!$snippet instanceof NeedTableAware)
48 48
             {
49 49
                 throw new \LogicException('Snippet has not expected NeedTableAware type');
50 50
             }
51 51
 
52
-            if($snippet->hasNeededTable($tableName))
52
+            if ($snippet->hasNeededTable($tableName))
53 53
             {
54 54
                 return true;
55 55
             }
Please login to merge, or discard this patch.
src/Queries/Snippets/Joins/AbstractJoin.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
         $using,
17 17
         $on;
18 18
 
19
-    public function __construct(string $table, ?string $alias = null)
19
+    public function __construct(string $table, ? string $alias = null)
20 20
     {
21 21
         $this->table = new Snippets\TableName($table, $alias);
22 22
         $this->on = [];
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
         return $this;
35 35
     }
36 36
 
37
-    public function on(?string $leftColumn, ?string $rightColumn): self
37
+    public function on(? string $leftColumn, ? string $rightColumn) : self
38 38
     {
39 39
         $this->using = null;
40 40
         $this->on[] = new Snippets\On($leftColumn, $rightColumn);
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 
59 59
     public function hasNeededTable(string $tableName): bool
60 60
     {
61
-        if($this->table->getName() === $tableName || $this->table->getAlias() === $tableName)
61
+        if ($this->table->getName() === $tableName || $this->table->getAlias() === $tableName)
62 62
         {
63 63
             return true;
64 64
         }
@@ -69,26 +69,26 @@  discard block
 block discarded – undo
69 69
 
70 70
     private function buildUsingConditionClause(): string
71 71
     {
72
-        if(!$this->using instanceof Snippet)
72
+        if (!$this->using instanceof Snippet)
73 73
         {
74 74
             return '';
75 75
         }
76 76
 
77
-        return ' ' . $this->using->toString();
77
+        return ' '.$this->using->toString();
78 78
     }
79 79
 
80 80
     private function buildOnConditionClause(): string
81 81
     {
82 82
         $conditionClause = array();
83 83
 
84
-        foreach($this->on as $on)
84
+        foreach ($this->on as $on)
85 85
         {
86
-            if($on instanceof Snippet)
86
+            if ($on instanceof Snippet)
87 87
             {
88 88
                 $conditionClause[] = $on->toString();
89 89
             }
90 90
         }
91 91
 
92
-        return empty($conditionClause) ? '' : ' ' . implode('', $conditionClause);
92
+        return empty($conditionClause) ? '' : ' '.implode('', $conditionClause);
93 93
     }
94 94
 }
Please login to merge, or discard this patch.
src/Queries/Snippets/From.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -14,9 +14,9 @@  discard block
 block discarded – undo
14 14
     /**
15 15
      * @param TableName|string $table
16 16
      */
17
-    public function __construct($table, ?string $alias = null)
17
+    public function __construct($table, ? string $alias = null)
18 18
     {
19
-        if(! $table instanceof TableName)
19
+        if (!$table instanceof TableName)
20 20
         {
21 21
             $table = new TableName($table, $alias);
22 22
         }
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 
32 32
     public function hasNeededTable(string $tableName): bool
33 33
     {
34
-        if($this->tableName->getName() === $tableName || $this->tableName->getAlias() === $tableName)
34
+        if ($this->tableName->getName() === $tableName || $this->tableName->getAlias() === $tableName)
35 35
         {
36 36
             return true;
37 37
         }
Please login to merge, or discard this patch.