Completed
Push — 6.0 ( 8cfa5f...e2c4d7 )
by liu
05:43
created
src/think/console/command/optimize/Schema.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -49,21 +49,21 @@  discard block
 block discarded – undo
49 49
             $tables = $this->app->db->getConnection()->getTables($dbName);
50 50
         } else {
51 51
             if ($app) {
52
-                $appPath   = $this->app->getBasePath() . $app . DIRECTORY_SEPARATOR;
53
-                $namespace = 'app\\' . $app;
52
+                $appPath   = $this->app->getBasePath().$app.DIRECTORY_SEPARATOR;
53
+                $namespace = 'app\\'.$app;
54 54
             } else {
55 55
                 $appPath   = $this->app->getBasePath();
56 56
                 $namespace = 'app';
57 57
             }
58 58
 
59
-            $path = $appPath . 'model';
59
+            $path = $appPath.'model';
60 60
             $list = is_dir($path) ? scandir($path) : [];
61 61
 
62 62
             foreach ($list as $file) {
63 63
                 if (0 === strpos($file, '.')) {
64 64
                     continue;
65 65
                 }
66
-                $class = '\\' . $namespace . '\\model\\' . pathinfo($file, PATHINFO_FILENAME);
66
+                $class = '\\'.$namespace.'\\model\\'.pathinfo($file, PATHINFO_FILENAME);
67 67
                 $this->buildModelSchema($class);
68 68
             }
69 69
 
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
             return;
72 72
         }
73 73
 
74
-        $db = isset($dbName) ? $dbName . '.' : '';
74
+        $db = isset($dbName) ? $dbName.'.' : '';
75 75
         $this->buildDataBaseSchema($schemaPath, $tables, $db);
76 76
 
77 77
         $output->writeln('<info>Succeed!</info>');
@@ -90,27 +90,27 @@  discard block
 block discarded – undo
90 90
             if (!is_dir($path)) {
91 91
                 mkdir($path, 0755, true);
92 92
             }
93
-            $content = '<?php ' . PHP_EOL . 'return ';
93
+            $content = '<?php '.PHP_EOL.'return ';
94 94
             $info    = $model->db()->getConnection()->getTableFieldsInfo($table);
95
-            $content .= var_export($info, true) . ';';
95
+            $content .= var_export($info, true).';';
96 96
 
97
-            file_put_contents($path . $dbName . '.' . $table . '.php', $content);
97
+            file_put_contents($path.$dbName.'.'.$table.'.php', $content);
98 98
         }
99 99
     }
100 100
 
101 101
     protected function buildDataBaseSchema(string $path, array $tables, string $db): void
102 102
     {
103 103
         if ('' == $db) {
104
-            $dbName = $this->app->db->getConnection()->getConfig('database') . '.';
104
+            $dbName = $this->app->db->getConnection()->getConfig('database').'.';
105 105
         } else {
106 106
             $dbName = $db;
107 107
         }
108 108
 
109 109
         foreach ($tables as $table) {
110
-            $content = '<?php ' . PHP_EOL . 'return ';
111
-            $info    = $this->app->db->getConnection()->getTableFieldsInfo($db . $table);
112
-            $content .= var_export($info, true) . ';';
113
-            file_put_contents($path . $dbName . $table . '.php', $content);
110
+            $content = '<?php '.PHP_EOL.'return ';
111
+            $info    = $this->app->db->getConnection()->getTableFieldsInfo($db.$table);
112
+            $content .= var_export($info, true).';';
113
+            file_put_contents($path.$dbName.$table.'.php', $content);
114 114
         }
115 115
     }
116 116
 }
Please login to merge, or discard this patch.