Completed
Push — master ( 63d777...551e0d )
by Ivan
15:14
created
src/driver/oracle/Schema.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -29,19 +29,19 @@  discard block
 block discarded – undo
29 29
         $columns = Collection::from($this
30 30
             ->query(
31 31
                 "SELECT * FROM all_tab_cols WHERE UPPER(table_name) = ? AND UPPER(owner) = ? and hidden_column = 'NO'",
32
-                [ strtoupper($table), strtoupper($this->name()) ]
32
+                [strtoupper($table), strtoupper($this->name())]
33 33
             ))
34
-            ->map(function ($v) {
34
+            ->map(function($v) {
35 35
                 $new = [];
36 36
                 foreach ($v as $kk => $vv) {
37 37
                     $new[strtoupper($kk)] = $vv;
38 38
                 }
39 39
                 return $new;
40 40
             })
41
-            ->mapKey(function ($v) {
41
+            ->mapKey(function($v) {
42 42
                 return $v['COLUMN_NAME'];
43 43
             })
44
-            ->map(function ($v) {
44
+            ->map(function($v) {
45 45
                 $v['length'] = null;
46 46
                 if (!isset($v['DATA_TYPE'])) {
47 47
                     return $v;
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
                     default:
54 54
                         if (strpos($type, 'char') !== false && strpos($type, '(') !== false) {
55 55
                             // extract length from varchar
56
-                            $v['length'] = (int)explode(')', (explode('(', $type)[1] ?? ''))[0];
56
+                            $v['length'] = (int) explode(')', (explode('(', $type)[1] ?? ''))[0];
57 57
                             $v['length'] = $v['length'] > 0 ? $v['length'] : null;
58 58
                         }
59 59
                         break;
@@ -69,9 +69,9 @@  discard block
 block discarded – undo
69 69
             ->query(
70 70
                 "SELECT constraint_name FROM all_constraints
71 71
                 WHERE table_name = ? AND constraint_type = ? AND UPPER(owner) = ?",
72
-                [ strtoupper($table), 'P', $owner ]
72
+                [strtoupper($table), 'P', $owner]
73 73
             ))
74
-            ->map(function ($v) {
74
+            ->map(function($v) {
75 75
                 $new = [];
76 76
                 foreach ($v as $kk => $vv) {
77 77
                     $new[strtoupper($kk)] = $vv;
@@ -86,9 +86,9 @@  discard block
 block discarded – undo
86 86
                 ->query(
87 87
                     "SELECT column_name FROM all_cons_columns
88 88
                     WHERE table_name = ? AND constraint_name = ? AND UPPER(owner) = ?",
89
-                    [ strtoupper($table), $pkname, $owner ]
89
+                    [strtoupper($table), $pkname, $owner]
90 90
                 ))
91
-                ->map(function ($v) {
91
+                ->map(function($v) {
92 92
                     $new = [];
93 93
                     foreach ($v as $kk => $vv) {
94 94
                         $new[strtoupper($kk)] = $vv;
@@ -117,9 +117,9 @@  discard block
 block discarded – undo
117 117
                         UPPER(ac.OWNER) = ? AND UPPER(ac.R_OWNER) = ? AND
118 118
                         ac.R_CONSTRAINT_NAME = ? AND ac.CONSTRAINT_TYPE = ?
119 119
                     ORDER BY cc.POSITION",
120
-                    [ $owner, $owner, $pkname, 'R' ]
120
+                    [$owner, $owner, $pkname, 'R']
121 121
                 ))
122
-                ->map(function ($v) {
122
+                ->map(function($v) {
123 123
                     $new = [];
124 124
                     foreach ($v as $kk => $vv) {
125 125
                         $new[strtoupper($kk)] = $vv;
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
                  as $relation
130 130
             ) {
131 131
                 $relations[$relation['CONSTRAINT_NAME']]['table'] = $relation['TABLE_NAME'];
132
-                $relations[$relation['CONSTRAINT_NAME']]['keymap'][$primary[(int)$relation['POSITION']-1]] =
132
+                $relations[$relation['CONSTRAINT_NAME']]['keymap'][$primary[(int) $relation['POSITION'] - 1]] =
133 133
                     $relation['COLUMN_NAME'];
134 134
             }
135 135
             foreach ($relations as $data) {
@@ -160,9 +160,9 @@  discard block
 block discarded – undo
160 160
                                 ac.TABLE_NAME = ? AND ac.CONSTRAINT_TYPE = ? AND
161 161
                                 cc.COLUMN_NAME IN (??)
162 162
                             ORDER BY POSITION",
163
-                            [ $owner, $owner, $data['table'], 'R', $columns ]
163
+                            [$owner, $owner, $data['table'], 'R', $columns]
164 164
                         ))
165
-                        ->map(function ($v) {
165
+                        ->map(function($v) {
166 166
                             $new = [];
167 167
                             foreach ($v as $kk => $vv) {
168 168
                                 $new[strtoupper($kk)] = $vv;
@@ -182,9 +182,9 @@  discard block
 block discarded – undo
182 182
                         ->query(
183 183
                             "SELECT COLUMN_NAME FROM all_cons_columns
184 184
                              WHERE UPPER(OWNER) = ? AND CONSTRAINT_NAME = ? ORDER BY POSITION",
185
-                            [ $owner, current($foreign['keymap']) ]
185
+                            [$owner, current($foreign['keymap'])]
186 186
                         ))
187
-                        ->map(function ($v) {
187
+                        ->map(function($v) {
188 188
                             $new = [];
189 189
                             foreach ($v as $kk => $vv) {
190 190
                                 $new[strtoupper($kk)] = $vv;
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
                     $relname = $foreign['table'];
200 200
                     $cntr = 1;
201 201
                     while ($definition->hasRelation($relname) || $definition->getName() == $relname) {
202
-                        $relname = $foreign['table'] . '_' . (++ $cntr);
202
+                        $relname = $foreign['table'].'_'.(++$cntr);
203 203
                     }
204 204
                     $definition->addRelation(
205 205
                         new TableRelation(
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
                     $relname = $data['table'];
216 216
                     $cntr = 1;
217 217
                     while ($definition->hasRelation($relname) || $definition->getName() == $relname) {
218
-                        $relname = $data['table'] . '_' . (++ $cntr);
218
+                        $relname = $data['table'].'_'.(++$cntr);
219 219
                     }
220 220
                     $definition->addRelation(
221 221
                         new TableRelation(
@@ -243,9 +243,9 @@  discard block
 block discarded – undo
243 243
                     LEFT JOIN all_cons_columns cc ON cc.OWNER = ac.OWNER AND cc.CONSTRAINT_NAME = ac.CONSTRAINT_NAME
244 244
                     WHERE UPPER(ac.OWNER) = ? AND UPPER(ac.R_OWNER) = ? AND ac.TABLE_NAME = ? AND ac.CONSTRAINT_TYPE = ?
245 245
                     ORDER BY cc.POSITION",
246
-                    [ $owner, $owner, strtoupper($table), 'R' ]
246
+                    [$owner, $owner, strtoupper($table), 'R']
247 247
                 ))
248
-                ->map(function ($v) {
248
+                ->map(function($v) {
249 249
                     $new = [];
250 250
                     foreach ($v as $kk => $vv) {
251 251
                         $new[strtoupper($kk)] = $vv;
@@ -263,9 +263,9 @@  discard block
 block discarded – undo
263 263
                     ->query(
264 264
                         "SELECT COLUMN_NAME FROM all_cons_columns
265 265
                          WHERE UPPER(OWNER) = ? AND CONSTRAINT_NAME = ? ORDER BY POSITION",
266
-                        [ $owner, current($data['keymap']) ]
266
+                        [$owner, current($data['keymap'])]
267 267
                     ))
268
-                    ->map(function ($v) {
268
+                    ->map(function($v) {
269 269
                         $new = [];
270 270
                         foreach ($v as $kk => $vv) {
271 271
                             $new[strtoupper($kk)] = $vv;
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
                 $relname = $data['table'];
281 281
                 $cntr = 1;
282 282
                 while ($definition->hasRelation($relname) || $definition->getName() == $relname) {
283
-                    $relname = $data['table'] . '_' . (++ $cntr);
283
+                    $relname = $data['table'].'_'.(++$cntr);
284 284
                 }
285 285
                 $definition->addRelation(
286 286
                     new TableRelation(
@@ -303,18 +303,18 @@  discard block
 block discarded – undo
303 303
                  SELECT VIEW_NAME AS TABLE_NAME FROM ALL_VIEWS where UPPER(OWNER) = ?",
304 304
                 [strtoupper($this->connection['name']), strtoupper($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;
310 310
                 }
311 311
                 return $new;
312 312
             })
313
-            ->mapKey(function ($v) {
313
+            ->mapKey(function($v) {
314 314
                 return strtolower($v['TABLE_NAME']);
315 315
             })
316 316
             ->pluck('TABLE_NAME')
317
-            ->map(function ($v) {
317
+            ->map(function($v) {
318 318
                 return $this->table($v)->toLowerCase();
319 319
             })
320 320
             ->toArray();
Please login to merge, or discard this patch.