Passed
Branch master (95b00f)
by Smoren
01:47
created
Category
src/Pdo/QueryRelationManager.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 
41 41
         /** @var array<string> $result */
42 42
         $result = [];
43
-        foreach($rows as $row) {
43
+        foreach ($rows as $row) {
44 44
             $result[] = $row['Field'];
45 45
         }
46 46
 
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 
60 60
         /** @var array<string> $result */
61 61
         $result = [];
62
-        foreach($rows as $row) {
62
+        foreach ($rows as $row) {
63 63
             $result[] = $row['Field'];
64 64
         }
65 65
 
Please login to merge, or discard this patch.
src/Pdo/QueryWrapper.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
         $this->query .= 'SELECT ';
67 67
 
68 68
         $buf = [];
69
-        foreach($arSelect as $alias => $field) {
69
+        foreach ($arSelect as $alias => $field) {
70 70
             $buf[] = addslashes($field).' AS '.addslashes($alias);
71 71
         }
72 72
 
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
     {
83 83
         $this->query .= ' FROM ';
84 84
 
85
-        foreach($mapFrom as $alias => $tableName) {
85
+        foreach ($mapFrom as $alias => $tableName) {
86 86
             $this->query .= ' '.addslashes($tableName).' '.addslashes($alias).' ';
87 87
             break;
88 88
         }
@@ -101,14 +101,14 @@  discard block
 block discarded – undo
101 101
     ): QueryWrapperInterface {
102 102
         $this->query .= " ".addslashes($type)." JOIN ";
103 103
 
104
-        foreach($mapTable as $alias => $tableName) {
104
+        foreach ($mapTable as $alias => $tableName) {
105 105
             $this->query .= addslashes($tableName).' '.addslashes($alias).' ';
106 106
             break;
107 107
         }
108 108
 
109 109
         $this->query .= " ON {$condition} ";
110 110
 
111
-        foreach($extraJoinParams as $key => $val) {
111
+        foreach ($extraJoinParams as $key => $val) {
112 112
             $this->mapParams[$key] = $val;
113 113
         }
114 114
 
@@ -125,13 +125,13 @@  discard block
 block discarded – undo
125 125
     {
126 126
         $db = $db ?? static::$pdo;
127 127
 
128
-        if(!$db) {
128
+        if (!$db) {
129 129
             throw new QueryRelationManagerException('no pdo connection opened');
130 130
         }
131 131
 
132 132
         $q = $db->prepare($this->query);
133 133
 
134
-        foreach($this->mapParams as $key => $val) {
134
+        foreach ($this->mapParams as $key => $val) {
135 135
             $q->bindValue($key, $val);
136 136
         }
137 137
 
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
     {
148 148
         $from = array_keys($this->mapParams);
149 149
         $to = array_values($this->mapParams);
150
-        foreach($to as &$param) {
150
+        foreach ($to as &$param) {
151 151
             $param = "'{$param}'";
152 152
         }
153 153
         unset($param);
Please login to merge, or discard this patch.
src/Base/Structs/TableCollection.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
      */
30 30
     public function add(Table $table): self
31 31
     {
32
-        if($this->mainTable === null) {
32
+        if ($this->mainTable === null) {
33 33
             $this->mainTable = $table;
34 34
         }
35 35
 
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
      */
46 46
     public function getMainTable(): Table
47 47
     {
48
-        if($this->mainTable === null) {
48
+        if ($this->mainTable === null) {
49 49
             throw new QueryRelationManagerException('no main table found in TableManager');
50 50
         }
51 51
 
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
      */
72 72
     public function each(callable $callback): self
73 73
     {
74
-        foreach($this->mapByAlias as $table) {
74
+        foreach ($this->mapByAlias as $table) {
75 75
             $callback($table);
76 76
         }
77 77
         return $this;
@@ -89,10 +89,10 @@  discard block
 block discarded – undo
89 89
         $tableAliasChain = $this->getTableAliasChain($tableAlias, $joinConditions);
90 90
         $result = [];
91 91
 
92
-        foreach($tableAliasChain as $alias) {
92
+        foreach ($tableAliasChain as $alias) {
93 93
             $table = $this->byAlias($alias);
94 94
 
95
-            foreach($table->primaryKey as $field) {
95
+            foreach ($table->primaryKey as $field) {
96 96
                 $result[] = "{$alias}_{$field}";
97 97
             }
98 98
         }
@@ -110,10 +110,10 @@  discard block
 block discarded – undo
110 110
     {
111 111
         $result = [];
112 112
 
113
-        while(true) {
113
+        while (true) {
114 114
             $result[] = $tableAlias;
115 115
 
116
-            if(!$joinConditions->issetByJoinAs($tableAlias)) {
116
+            if (!$joinConditions->issetByJoinAs($tableAlias)) {
117 117
                 break;
118 118
             }
119 119
 
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
      */
134 134
     protected function addToMap(string $mapName, string $key, Table $table): self
135 135
     {
136
-        if(isset($this->{$mapName}[$table->{$key}])) {
136
+        if (isset($this->{$mapName}[$table->{$key}])) {
137 137
             throw new QueryRelationManagerException("duplicate key '{$key}' in map '{$mapName}' of TableManager");
138 138
         }
139 139
         $this->{$mapName}[$table->{$key}] = $table;
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
      */
151 151
     protected function getFromMap(string $mapName, string $key): Table
152 152
     {
153
-        if(!isset($this->{$mapName}[$key])) {
153
+        if (!isset($this->{$mapName}[$key])) {
154 154
             throw new QueryRelationManagerException("key '{$key}' not found in map '{$mapName}' of TableManager");
155 155
         }
156 156
 
Please login to merge, or discard this patch.
src/Base/Structs/JoinCondition.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -92,7 +92,7 @@
 block discarded – undo
92 92
     public function stringify(): string
93 93
     {
94 94
         $joins = [];
95
-        foreach($this->joinCondition as $linkBy => $linkTo) {
95
+        foreach ($this->joinCondition as $linkBy => $linkTo) {
96 96
             $joins[] = "{$this->table->alias}.{$linkBy} = {$this->joinTo->alias}.{$linkTo}";
97 97
         }
98 98
 
Please login to merge, or discard this patch.
src/Base/Structs/Table.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -83,14 +83,14 @@  discard block
 block discarded – undo
83 83
         $this->containerFieldAlias = $containerFieldAlias;
84 84
 
85 85
         $bufMap = [];
86
-        foreach($fields as $field) {
86
+        foreach ($fields as $field) {
87 87
             $bufMap[$field] = "{$this->alias}_{$field}";
88 88
             $this->fieldMap["{$this->alias}.{$field}"] = "{$this->alias}_{$field}";
89 89
             $this->fieldMapReverse["{$this->alias}_{$field}"] = $field;
90 90
         }
91 91
 
92
-        foreach($this->primaryKey as $field) {
93
-            if(!isset($bufMap[$field])) {
92
+        foreach ($this->primaryKey as $field) {
93
+            if (!isset($bufMap[$field])) {
94 94
                 throw new QueryRelationManagerException("pk field {$field} not found in field list");
95 95
             }
96 96
             $this->pkFieldMapReverse[$bufMap[$field]] = $field;
@@ -132,8 +132,8 @@  discard block
 block discarded – undo
132 132
      */
133 133
     public function issetDataInRow(array &$row): bool
134 134
     {
135
-        foreach($this->pkFieldMapReverse as $prefixedKey => $key) {
136
-            if($row[$prefixedKey] !== null) {
135
+        foreach ($this->pkFieldMapReverse as $prefixedKey => $key) {
136
+            if ($row[$prefixedKey] !== null) {
137 137
                 return true;
138 138
             }
139 139
         }
@@ -159,13 +159,13 @@  discard block
 block discarded – undo
159 159
     {
160 160
         $item = [];
161 161
 
162
-        foreach($this->fieldMapReverse as $fieldPrefixed => $field) {
162
+        foreach ($this->fieldMapReverse as $fieldPrefixed => $field) {
163 163
             $item[$field] = $row[$fieldPrefixed];
164 164
         }
165 165
 
166 166
         /** @var JoinCondition $cond */
167
-        foreach($conditionCollection->byJoinTo($this->alias) as $cond) {
168
-            switch($cond->type) {
167
+        foreach ($conditionCollection->byJoinTo($this->alias) as $cond) {
168
+            switch ($cond->type) {
169 169
                 case JoinCondition::TYPE_MULTIPLE:
170 170
                     $item[$cond->table->containerFieldAlias] = [];
171 171
                     break;
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 
180 180
         $primaryKeyValue = $this->stringifyPrimaryKeyValue($row);
181 181
 
182
-        if($conditionCollection->issetByJoinAs($this->alias)) {
182
+        if ($conditionCollection->issetByJoinAs($this->alias)) {
183 183
             $cond = $conditionCollection->byJoinAs($this->alias);
184 184
             $joinTo = $cond->joinTo;
185 185
             $aliasTo = $joinTo->alias;
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
     public function getPrimaryKeyForSelect(): array
203 203
     {
204 204
         $result = [];
205
-        foreach($this->primaryKey as $field) {
205
+        foreach ($this->primaryKey as $field) {
206 206
             $result[] = "{$this->alias}.{$field}";
207 207
         }
208 208
 
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
     {
230 230
         $primaryKeyValues = [];
231 231
 
232
-        foreach($this->pkFieldChain as $field) {
232
+        foreach ($this->pkFieldChain as $field) {
233 233
             $primaryKeyValues[] = $row[$field];
234 234
         }
235 235
 
Please login to merge, or discard this patch.
src/Base/Structs/JoinConditionCollection.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -30,15 +30,15 @@  discard block
 block discarded – undo
30 30
      */
31 31
     public function add(JoinCondition $condition): self
32 32
     {
33
-        if(isset($this->mapByJoinAs[$condition->table->alias])) {
33
+        if (isset($this->mapByJoinAs[$condition->table->alias])) {
34 34
             throw new QueryRelationManagerException("duplicate table alias '{$condition->table->alias}'");
35 35
         }
36 36
         $this->mapByJoinAs[$condition->table->alias] = $condition;
37 37
 
38
-        if(!isset($this->matrixByJoinTo[$condition->joinTo->alias])) {
38
+        if (!isset($this->matrixByJoinTo[$condition->joinTo->alias])) {
39 39
             $this->matrixByJoinTo[$condition->joinTo->alias] = [];
40 40
         }
41
-        if(isset($this->matrixByJoinTo[$condition->joinTo->alias][$condition->table->alias])) {
41
+        if (isset($this->matrixByJoinTo[$condition->joinTo->alias][$condition->table->alias])) {
42 42
             throw new QueryRelationManagerException("duplicate table alias '{$condition->table->alias}'");
43 43
         }
44 44
         $this->matrixByJoinTo[$condition->joinTo->alias][$condition->table->alias] = $condition;
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
      */
54 54
     public function issetByJoinAs(string $joinAs): bool
55 55
     {
56
-        if(!isset($this->mapByJoinAs[$joinAs])) {
56
+        if (!isset($this->mapByJoinAs[$joinAs])) {
57 57
             return false;
58 58
         }
59 59
 
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
      */
79 79
     public function byJoinTo(string $joinTo): array
80 80
     {
81
-        if(!isset($this->matrixByJoinTo[$joinTo])) {
81
+        if (!isset($this->matrixByJoinTo[$joinTo])) {
82 82
             return [];
83 83
         }
84 84
         return $this->matrixByJoinTo[$joinTo];
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
      */
93 93
     public function each(callable $callback): self
94 94
     {
95
-        foreach($this->mapByJoinAs as $condition) {
95
+        foreach ($this->mapByJoinAs as $condition) {
96 96
             $callback($condition);
97 97
         }
98 98
         return $this;
Please login to merge, or discard this patch.
src/Base/QueryRelationManagerBase.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -190,32 +190,32 @@  discard block
 block discarded – undo
190 190
 
191 191
         $bufMap = [];
192 192
 
193
-        foreach($rows as $row) {
193
+        foreach ($rows as $row) {
194 194
             $this->tableCollection->each(function(Table $table) use (&$map, &$row, &$bufMap) {
195
-                if(!$table->issetDataInRow($row)) {
195
+                if (!$table->issetDataInRow($row)) {
196 196
                     return;
197 197
                 }
198 198
 
199 199
                 [$item, $pkValue, $alias, $aliasTo, $fkValue, $containerFieldAlias, $type]
200 200
                     = $table->getDataFromRow($row, $this->joinConditionCollection);
201 201
 
202
-                if(!isset($map[$alias][$pkValue])) {
202
+                if (!isset($map[$alias][$pkValue])) {
203 203
                     $map[$alias][$pkValue] = &$item;
204 204
                 }
205 205
 
206
-                if($aliasTo !== null) {
206
+                if ($aliasTo !== null) {
207 207
                     $bufMapKey = implode('-', [$aliasTo, $fkValue, $containerFieldAlias, $pkValue]);
208 208
                     /** @var string $type */
209
-                    switch($type) {
209
+                    switch ($type) {
210 210
                         case JoinCondition::TYPE_SINGLE:
211
-                            if(!isset($bufMap[$bufMapKey])) {
211
+                            if (!isset($bufMap[$bufMapKey])) {
212 212
                                 /** @var mixed[][][] $map */
213 213
                                 $map[$aliasTo][$fkValue][$containerFieldAlias] = &$item;
214 214
                                 $bufMap[$bufMapKey] = 1;
215 215
                             }
216 216
                             break;
217 217
                         case JoinCondition::TYPE_MULTIPLE:
218
-                            if(!isset($bufMap[$bufMapKey])) {
218
+                            if (!isset($bufMap[$bufMapKey])) {
219 219
                                 /** @var mixed[][][][] $map */
220 220
                                 $map[$aliasTo][$fkValue][$containerFieldAlias][] = &$item;
221 221
                                 $bufMap[$bufMapKey] = 1;
@@ -228,8 +228,8 @@  discard block
 block discarded – undo
228 228
             });
229 229
         }
230 230
 
231
-        foreach($this->modifierMap as $alias => $modifier) {
232
-            foreach($map[$alias] as $pk => &$item) {
231
+        foreach ($this->modifierMap as $alias => $modifier) {
232
+            foreach ($map[$alias] as $pk => &$item) {
233 233
                 ($modifier)($item);
234 234
             }
235 235
             unset($item);
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 
256 256
         $arSelect = [];
257 257
         $this->tableCollection->each(function(Table $table) use (&$arSelect) {
258
-            foreach($table->getFieldMap() as $fieldName => $fieldNamePrefixed) {
258
+            foreach ($table->getFieldMap() as $fieldName => $fieldNamePrefixed) {
259 259
                 $arSelect[$fieldNamePrefixed] = $fieldName;
260 260
             }
261 261
         });
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
         });
277 277
 
278 278
 
279
-        foreach($this->filters as $modifier) {
279
+        foreach ($this->filters as $modifier) {
280 280
             $modifier($this->query->getQuery());
281 281
         }
282 282
 
Please login to merge, or discard this patch.