Passed
Push — 6.0 ( 6d6bd6...740410 )
by liu
05:20
created
src/think/console/command/optimize/Schema.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -31,14 +31,14 @@  discard block
 block discarded – undo
31 31
     {
32 32
         $app = $input->getArgument('app');
33 33
 
34
-        if (empty($app) && !is_dir($this->app->getBasePath() . 'controller')) {
34
+        if (empty($app) && !is_dir($this->app->getBasePath().'controller')) {
35 35
             $output->writeln('<error>Miss app name!</error>');
36 36
             return false;
37 37
         }
38 38
 
39 39
         if ($app) {
40
-            $appPath   = $this->app->getBasePath() . $app . DIRECTORY_SEPARATOR;
41
-            $namespace = 'app\\' . $app;
40
+            $appPath   = $this->app->getBasePath().$app.DIRECTORY_SEPARATOR;
41
+            $namespace = 'app\\'.$app;
42 42
         } else {
43 43
             $appPath   = $this->app->getBasePath();
44 44
             $namespace = 'app';
@@ -62,14 +62,14 @@  discard block
 block discarded – undo
62 62
             $tables = $this->app->db->getConnection()->getTables($dbName);
63 63
         } else {
64 64
 
65
-            $path = $appPath . 'model';
65
+            $path = $appPath.'model';
66 66
             $list = is_dir($path) ? scandir($path) : [];
67 67
 
68 68
             foreach ($list as $file) {
69 69
                 if (0 === strpos($file, '.')) {
70 70
                     continue;
71 71
                 }
72
-                $class = '\\' . $namespace . '\\model\\' . pathinfo($file, PATHINFO_FILENAME);
72
+                $class = '\\'.$namespace.'\\model\\'.pathinfo($file, PATHINFO_FILENAME);
73 73
                 $this->buildModelSchema($class);
74 74
             }
75 75
 
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
             return;
78 78
         }
79 79
 
80
-        $db = isset($dbName) ? $dbName . '.' : '';
80
+        $db = isset($dbName) ? $dbName.'.' : '';
81 81
         $this->buildDataBaseSchema($schemaPath, $tables, $db);
82 82
 
83 83
         $output->writeln('<info>Succeed!</info>');
@@ -94,27 +94,27 @@  discard block
 block discarded – undo
94 94
             $table   = $model->getTable();
95 95
             $dbName  = $model->getConnection()->getConfig('database');
96 96
             $path    = $model->getConnection()->getConfig('schema_cache_path');
97
-            $content = '<?php ' . PHP_EOL . 'return ';
97
+            $content = '<?php '.PHP_EOL.'return ';
98 98
             $info    = $model->db()->getConnection()->getFields($table);
99
-            $content .= var_export($info, true) . ';';
99
+            $content .= var_export($info, true).';';
100 100
 
101
-            file_put_contents($path . $dbName . '.' . $table . '.php', $content);
101
+            file_put_contents($path.$dbName.'.'.$table.'.php', $content);
102 102
         }
103 103
     }
104 104
 
105 105
     protected function buildDataBaseSchema(string $path, array $tables, string $db): void
106 106
     {
107 107
         if ('' == $db) {
108
-            $dbName = $this->app->db->getConnection()->getConfig('database') . '.';
108
+            $dbName = $this->app->db->getConnection()->getConfig('database').'.';
109 109
         } else {
110 110
             $dbName = $db;
111 111
         }
112 112
 
113 113
         foreach ($tables as $table) {
114
-            $content = '<?php ' . PHP_EOL . 'return ';
115
-            $info    = $this->app->db->getConnection()->getFields($db . $table);
116
-            $content .= var_export($info, true) . ';';
117
-            file_put_contents($path . $dbName . $table . '.php', $content);
114
+            $content = '<?php '.PHP_EOL.'return ';
115
+            $info    = $this->app->db->getConnection()->getFields($db.$table);
116
+            $content .= var_export($info, true).';';
117
+            file_put_contents($path.$dbName.$table.'.php', $content);
118 118
         }
119 119
     }
120 120
 }
Please login to merge, or discard this patch.