Completed
Push — master ( 37635b...73994c )
by Ivan
02:45
created
src/driver/mysql/Driver.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
     {
36 36
         if ($this->lnk === null) {
37 37
             $this->lnk = new \mysqli(
38
-                (isset($this->connection['opts']['persist']) && $this->connection['opts']['persist'] ? 'p:' : '') .
38
+                (isset($this->connection['opts']['persist']) && $this->connection['opts']['persist'] ? 'p:' : '').
39 39
                     $this->connection['host'],
40 40
                 $this->connection['user'],
41 41
                 $this->connection['pass'],
@@ -111,10 +111,10 @@  discard block
 block discarded – undo
111 111
             $comments = Collection::from(
112 112
                 $this->query(
113 113
                     "SELECT TABLE_NAME, TABLE_COMMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = ?",
114
-                    [ $this->connection['name'] ]
114
+                    [$this->connection['name']]
115 115
                 )
116 116
             )
117
-            ->mapKey(function ($v) {
117
+            ->mapKey(function($v) {
118 118
                 return $v['TABLE_NAME'];
119 119
             })
120 120
             ->pluck('TABLE_COMMENT')
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
                      WHERE
134 134
                         TABLE_SCHEMA = ? AND TABLE_NAME IS NOT NULL AND
135 135
                         REFERENCED_TABLE_SCHEMA = ? AND REFERENCED_TABLE_NAME IS NOT NULL",
136
-                    [ $this->connection['name'], $this->connection['name'] ]
136
+                    [$this->connection['name'], $this->connection['name']]
137 137
                 )
138 138
             )->toArray();
139 139
             foreach ($col as $row) {
@@ -151,8 +151,8 @@  discard block
 block discarded – undo
151 151
             ->addColumns(
152 152
                 $columns
153 153
                     ->clone()
154
-                    ->mapKey(function ($v) { return $v['Field']; })
155
-                    ->map(function ($v) {
154
+                    ->mapKey(function($v) { return $v['Field']; })
155
+                    ->map(function($v) {
156 156
                         $v['length'] = null;
157 157
                         if (!isset($v['Type'])) {
158 158
                             return $v;
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
                             default:
175 175
                                 if (strpos($type, 'char') !== false && strpos($type, '(') !== false) {
176 176
                                     // extract length from varchar
177
-                                    $v['length'] = (int)explode(')', explode('(', $type)[1])[0];
177
+                                    $v['length'] = (int) explode(')', explode('(', $type)[1])[0];
178 178
                                     $v['length'] = $v['length'] > 0 ? $v['length'] : null;
179 179
                                 }
180 180
                                 break;
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
             ->setPrimaryKey(
187 187
                 $columns
188 188
                     ->clone()
189
-                    ->filter(function ($v) { return $v['Key'] === 'PRI'; })
189
+                    ->filter(function($v) { return $v['Key'] === 'PRI'; })
190 190
                     ->pluck('Field')
191 191
                     ->toArray()
192 192
             )
@@ -213,10 +213,10 @@  discard block
 block discarded – undo
213 213
                 $usedcol = [];
214 214
                 if (count($columns)) {
215 215
                     foreach (Collection::from($relationsT[$data['table']] ?? [])
216
-                        ->filter(function ($v) use ($columns) {
216
+                        ->filter(function($v) use ($columns) {
217 217
                             return in_array($v['COLUMN_NAME'], $columns);
218 218
                         })
219
-                        ->map(function ($v) {
219
+                        ->map(function($v) {
220 220
                             $new = [];
221 221
                             foreach ($v as $kk => $vv) {
222 222
                                 $new[strtoupper($kk)] = $vv;
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
                     $relname = $foreign['table'];
235 235
                     $cntr = 1;
236 236
                     while ($definition->hasRelation($relname) || $definition->getName() == $relname) {
237
-                        $relname = $foreign['table'] . '_' . (++ $cntr);
237
+                        $relname = $foreign['table'].'_'.(++$cntr);
238 238
                     }
239 239
                     $definition->addRelation(
240 240
                         new TableRelation(
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
                     $relname = $data['table'];
251 251
                     $cntr = 1;
252 252
                     while ($definition->hasRelation($relname) || $definition->getName() == $relname) {
253
-                        $relname = $data['table'] . '_' . (++ $cntr);
253
+                        $relname = $data['table'].'_'.(++$cntr);
254 254
                     }
255 255
                     $definition->addRelation(
256 256
                         new TableRelation(
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
             // resulting in a "belongsTo" relationship
268 268
             $relations = [];
269 269
             foreach (Collection::from($relationsT[$table] ?? [])
270
-                ->map(function ($v) {
270
+                ->map(function($v) {
271 271
                     $new = [];
272 272
                     foreach ($v as $kk => $vv) {
273 273
                         $new[strtoupper($kk)] = $vv;
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
                 $relname = $data['table'];
283 283
                 $cntr = 1;
284 284
                 while ($definition->hasRelation($relname) || $definition->getName() == $relname) {
285
-                    $relname = $data['table'] . '_' . (++ $cntr);
285
+                    $relname = $data['table'].'_'.(++$cntr);
286 286
                 }
287 287
                 $definition->addRelation(
288 288
                     new TableRelation(
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
                 "SELECT table_name FROM information_schema.tables where table_schema = ?",
304 304
                 [$this->connection['name']]
305 305
             ))
306
-            ->map(function ($v) {
306
+            ->map(function($v) {
307 307
                 $new = [];
308 308
                 foreach ($v as $kk => $vv) {
309 309
                     $new[strtoupper($kk)] = $vv;
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
                 return $new;
312 312
             })
313 313
             ->pluck('TABLE_NAME')
314
-            ->map(function ($v) {
314
+            ->map(function($v) {
315 315
                 return $this->table($v);
316 316
             })
317 317
             ->toArray();
Please login to merge, or discard this patch.