Completed
Pull Request — 6.0 (#1913)
by yun
09:37 queued 04:47
created
src/think/console/Command.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 // +----------------------------------------------------------------------
9 9
 // | Author: yunwuxin <[email protected]>
10 10
 // +----------------------------------------------------------------------
11
-declare (strict_types = 1);
11
+declare(strict_types=1);
12 12
 
13 13
 namespace think\console;
14 14
 
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
     private $console;
29 29
     private $name;
30 30
     private $processTitle;
31
-    private $aliases                         = [];
31
+    private $aliases = [];
32 32
     private $definition;
33 33
     private $help;
34 34
     private $description;
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
         ];
405 405
         $replacements = [
406 406
             $name,
407
-            $_SERVER['PHP_SELF'] . ' ' . $name,
407
+            $_SERVER['PHP_SELF'].' '.$name,
408 408
         ];
409 409
 
410 410
         return str_replace($placeholders, $replacements, $this->getHelp());
Please login to merge, or discard this patch.
src/think/console/input/Definition.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -356,11 +356,11 @@
 block discarded – undo
356 356
         }
357 357
 
358 358
         foreach ($this->getArguments() as $argument) {
359
-            $element = '<' . $argument->getName() . '>';
359
+            $element = '<'.$argument->getName().'>';
360 360
             if (!$argument->isRequired()) {
361
-                $element = '[' . $element . ']';
361
+                $element = '['.$element.']';
362 362
             } elseif ($argument->isArray()) {
363
-                $element .= ' (' . $element . ')';
363
+                $element .= ' ('.$element.')';
364 364
             }
365 365
 
366 366
             if ($argument->isArray()) {
Please login to merge, or discard this patch.
src/think/console/Output.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 // +----------------------------------------------------------------------
9 9
 // | Author: yunwuxin <[email protected]>
10 10
 // +----------------------------------------------------------------------
11
-declare (strict_types = 1);
11
+declare(strict_types=1);
12 12
 
13 13
 namespace think\console;
14 14
 
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 
69 69
     public function __construct($driver = 'console')
70 70
     {
71
-        $class = '\\think\\console\\output\\driver\\' . ucwords($driver);
71
+        $class = '\\think\\console\\output\\driver\\'.ucwords($driver);
72 72
 
73 73
         $this->handle = new $class($this);
74 74
     }
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
         if ($this->handle && method_exists($this->handle, $method)) {
218 218
             return call_user_func_array([$this->handle, $method], $args);
219 219
         } else {
220
-            throw new Exception('method not exists:' . __CLASS__ . '->' . $method);
220
+            throw new Exception('method not exists:'.__CLASS__.'->'.$method);
221 221
         }
222 222
     }
223 223
 
Please login to merge, or discard this patch.
src/think/console/Table.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 // +----------------------------------------------------------------------
9 9
 // | Author: yunwuxin <[email protected]>
10 10
 // +----------------------------------------------------------------------
11
-declare (strict_types = 1);
11
+declare(strict_types=1);
12 12
 
13 13
 namespace think\console;
14 14
 
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
             $array[] = str_repeat($style[1], $width + 2);
197 197
         }
198 198
 
199
-        return $style[0] . implode($style[2], $array) . $style[3] . PHP_EOL;
199
+        return $style[0].implode($style[2], $array).$style[3].PHP_EOL;
200 200
     }
201 201
 
202 202
     /**
@@ -210,11 +210,11 @@  discard block
 block discarded – undo
210 210
         $content = $this->renderSeparator('top');
211 211
 
212 212
         foreach ($this->header as $key => $header) {
213
-            $array[] = ' ' . str_pad($header, $this->colWidth[$key], $style[1], $this->headerAlign);
213
+            $array[] = ' '.str_pad($header, $this->colWidth[$key], $style[1], $this->headerAlign);
214 214
         }
215 215
 
216 216
         if (!empty($array)) {
217
-            $content .= $style[0] . implode(' ' . $style[2], $array) . ' ' . $style[3] . PHP_EOL;
217
+            $content .= $style[0].implode(' '.$style[2], $array).' '.$style[3].PHP_EOL;
218 218
 
219 219
             if (!empty($this->rows)) {
220 220
                 $content .= $this->renderSeparator('middle');
@@ -257,20 +257,20 @@  discard block
 block discarded – undo
257 257
                     $content .= $this->renderSeparator('middle');
258 258
                 } elseif (is_scalar($row)) {
259 259
                     $content .= $this->renderSeparator('cross-top');
260
-                    $array = str_pad($row, 3 * (count($this->colWidth) - 1) + array_reduce($this->colWidth, function ($a, $b) {
260
+                    $array = str_pad($row, 3 * (count($this->colWidth) - 1) + array_reduce($this->colWidth, function($a, $b) {
261 261
                         return $a + $b;
262 262
                     }));
263 263
 
264
-                    $content .= $style[0] . ' ' . $array . ' ' . $style[3] . PHP_EOL;
264
+                    $content .= $style[0].' '.$array.' '.$style[3].PHP_EOL;
265 265
                     $content .= $this->renderSeparator('cross-bottom');
266 266
                 } else {
267 267
                     $array = [];
268 268
 
269 269
                     foreach ($row as $key => $val) {
270
-                        $array[] = ' ' . str_pad((string) $val, $this->colWidth[$key], ' ', $this->cellAlign);
270
+                        $array[] = ' '.str_pad((string) $val, $this->colWidth[$key], ' ', $this->cellAlign);
271 271
                     }
272 272
 
273
-                    $content .= $style[0] . implode(' ' . $style[2], $array) . ' ' . $style[3] . PHP_EOL;
273
+                    $content .= $style[0].implode(' '.$style[2], $array).' '.$style[3].PHP_EOL;
274 274
 
275 275
                 }
276 276
             }
Please login to merge, or discard this patch.
src/think/console/Input.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 // +----------------------------------------------------------------------
9 9
 // | Author: yunwuxin <[email protected]>
10 10
 // +----------------------------------------------------------------------
11
-declare (strict_types = 1);
11
+declare(strict_types=1);
12 12
 
13 13
 namespace think\console;
14 14
 
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
 
268 268
         foreach ($this->tokens as $token) {
269 269
             foreach ($values as $value) {
270
-                if ($token === $value || 0 === strpos($token, $value . '=')) {
270
+                if ($token === $value || 0 === strpos($token, $value.'=')) {
271 271
                     return true;
272 272
                 }
273 273
             }
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
             $token = array_shift($tokens);
292 292
 
293 293
             foreach ($values as $value) {
294
-                if ($token === $value || 0 === strpos($token, $value . '=')) {
294
+                if ($token === $value || 0 === strpos($token, $value.'=')) {
295 295
                     if (false !== $pos = strpos($token, '=')) {
296 296
                         return substr($token, $pos + 1);
297 297
                     }
@@ -448,9 +448,9 @@  discard block
 block discarded – undo
448 448
      */
449 449
     public function __toString()
450 450
     {
451
-        $tokens = array_map(function ($token) {
451
+        $tokens = array_map(function($token) {
452 452
             if (preg_match('{^(-[^=]+=)(.+)}', $token, $match)) {
453
-                return $match[1] . $this->escapeToken($match[2]);
453
+                return $match[1].$this->escapeToken($match[2]);
454 454
             }
455 455
 
456 456
             if ($token && '-' !== $token[0]) {
Please login to merge, or discard this patch.
src/think/console/command/Version.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 // +----------------------------------------------------------------------
9 9
 // | Author: liu21st <[email protected]>
10 10
 // +----------------------------------------------------------------------
11
-declare (strict_types = 1);
11
+declare(strict_types=1);
12 12
 
13 13
 namespace think\console\command;
14 14
 
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 
28 28
     protected function execute(Input $input, Output $output)
29 29
     {
30
-        $output->writeln('v' . $this->app->version());
30
+        $output->writeln('v'.$this->app->version());
31 31
     }
32 32
 
33 33
 }
Please login to merge, or discard this patch.
src/think/console/command/Make.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
         $pathname = $this->getPathName($classname);
37 37
 
38 38
         if (is_file($pathname)) {
39
-            $output->writeln('<error>' . $this->type . ':' . $classname . ' already exists!</error>');
39
+            $output->writeln('<error>'.$this->type.':'.$classname.' already exists!</error>');
40 40
             return false;
41 41
         }
42 42
 
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 
47 47
         file_put_contents($pathname, $this->buildClass($classname));
48 48
 
49
-        $output->writeln('<info>' . $this->type . ':' . $classname . ' created successfully.</info>');
49
+        $output->writeln('<info>'.$this->type.':'.$classname.' created successfully.</info>');
50 50
     }
51 51
 
52 52
     protected function buildClass(string $name)
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 
56 56
         $namespace = trim(implode('\\', array_slice(explode('\\', $name), 0, -1)), '\\');
57 57
 
58
-        $class = str_replace($namespace . '\\', '', $name);
58
+        $class = str_replace($namespace.'\\', '', $name);
59 59
 
60 60
         return str_replace(['{%className%}', '{%actionSuffix%}', '{%namespace%}', '{%app_namespace%}'], [
61 61
             $class,
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
     {
70 70
         $name = str_replace('app\\', '', $name);
71 71
 
72
-        return $this->app->getBasePath() . ltrim(str_replace('\\', '/', $name), '/') . '.php';
72
+        return $this->app->getBasePath().ltrim(str_replace('\\', '/', $name), '/').'.php';
73 73
     }
74 74
 
75 75
     protected function getClassName(string $name): string
@@ -88,12 +88,12 @@  discard block
 block discarded – undo
88 88
             $name = str_replace('/', '\\', $name);
89 89
         }
90 90
 
91
-        return $this->getNamespace($app) . '\\' . $name;
91
+        return $this->getNamespace($app).'\\'.$name;
92 92
     }
93 93
 
94 94
     protected function getNamespace(string $app): string
95 95
     {
96
-        return 'app' . ($app ? '\\' . $app : '');
96
+        return 'app'.($app ? '\\'.$app : '');
97 97
     }
98 98
 
99 99
 }
Please login to merge, or discard this patch.
src/think/console/command/Build.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -40,12 +40,12 @@  discard block
 block discarded – undo
40 40
         $this->basePath = $this->app->getBasePath();
41 41
         $app            = $input->getArgument('app') ?: '';
42 42
 
43
-        if (empty($app) && !is_dir($this->basePath . 'controller')) {
43
+        if (empty($app) && !is_dir($this->basePath.'controller')) {
44 44
             $output->writeln('<error>Miss app name!</error>');
45 45
             return false;
46 46
         }
47 47
 
48
-        $list = include $this->basePath . 'build.php';
48
+        $list = include $this->basePath.'build.php';
49 49
 
50 50
         if (empty($list)) {
51 51
             $output->writeln("Build file Is Empty");
@@ -66,13 +66,13 @@  discard block
 block discarded – undo
66 66
      */
67 67
     protected function buildApp(string $app, array $list = []): void
68 68
     {
69
-        if (!is_dir($this->basePath . $app)) {
69
+        if (!is_dir($this->basePath.$app)) {
70 70
             // 创建应用目录
71
-            mkdir($this->basePath . $app);
71
+            mkdir($this->basePath.$app);
72 72
         }
73 73
 
74
-        $appPath   = $this->basePath . ($app ? $app . DIRECTORY_SEPARATOR : '');
75
-        $namespace = 'app' . ($app ? '\\' . $app : '');
74
+        $appPath   = $this->basePath.($app ? $app.DIRECTORY_SEPARATOR : '');
75
+        $namespace = 'app'.($app ? '\\'.$app : '');
76 76
 
77 77
         // 创建配置文件和公共文件
78 78
         $this->buildCommon($app);
@@ -83,41 +83,41 @@  discard block
 block discarded – undo
83 83
             if ('__dir__' == $path) {
84 84
                 // 生成子目录
85 85
                 foreach ($file as $dir) {
86
-                    $this->checkDirBuild($appPath . $dir);
86
+                    $this->checkDirBuild($appPath.$dir);
87 87
                 }
88 88
             } elseif ('__file__' == $path) {
89 89
                 // 生成(空白)文件
90 90
                 foreach ($file as $name) {
91
-                    if (!is_file($appPath . $name)) {
92
-                        file_put_contents($appPath . $name, 'php' == pathinfo($name, PATHINFO_EXTENSION) ? '<?php' . PHP_EOL : '');
91
+                    if (!is_file($appPath.$name)) {
92
+                        file_put_contents($appPath.$name, 'php' == pathinfo($name, PATHINFO_EXTENSION) ? '<?php'.PHP_EOL : '');
93 93
                     }
94 94
                 }
95 95
             } else {
96 96
                 // 生成相关MVC文件
97 97
                 foreach ($file as $val) {
98 98
                     $val      = trim($val);
99
-                    $filename = $appPath . $path . DIRECTORY_SEPARATOR . $val . '.php';
100
-                    $space    = $namespace . '\\' . $path;
99
+                    $filename = $appPath.$path.DIRECTORY_SEPARATOR.$val.'.php';
100
+                    $space    = $namespace.'\\'.$path;
101 101
                     $class    = $val;
102 102
                     switch ($path) {
103 103
                         case 'controller': // 控制器
104 104
                             if ($this->app->config->get('route.controller_suffix')) {
105
-                                $filename = $appPath . $path . DIRECTORY_SEPARATOR . $val . 'Controller.php';
106
-                                $class    = $val . 'Controller';
105
+                                $filename = $appPath.$path.DIRECTORY_SEPARATOR.$val.'Controller.php';
106
+                                $class    = $val.'Controller';
107 107
                             }
108
-                            $content = "<?php" . PHP_EOL . "namespace {$space};" . PHP_EOL . PHP_EOL . "class {$class}" . PHP_EOL . "{" . PHP_EOL . PHP_EOL . "}";
108
+                            $content = "<?php".PHP_EOL."namespace {$space};".PHP_EOL.PHP_EOL."class {$class}".PHP_EOL."{".PHP_EOL.PHP_EOL."}";
109 109
                             break;
110 110
                         case 'model': // 模型
111
-                            $content = "<?php" . PHP_EOL . "namespace {$space};" . PHP_EOL . PHP_EOL . "use think\Model;" . PHP_EOL . PHP_EOL . "class {$class} extends Model" . PHP_EOL . "{" . PHP_EOL . PHP_EOL . "}";
111
+                            $content = "<?php".PHP_EOL."namespace {$space};".PHP_EOL.PHP_EOL."use think\Model;".PHP_EOL.PHP_EOL."class {$class} extends Model".PHP_EOL."{".PHP_EOL.PHP_EOL."}";
112 112
                             break;
113 113
                         case 'view': // 视图
114
-                            $filename = $appPath . $path . DIRECTORY_SEPARATOR . $val . '.html';
114
+                            $filename = $appPath.$path.DIRECTORY_SEPARATOR.$val.'.html';
115 115
                             $this->checkDirBuild(dirname($filename));
116 116
                             $content = '';
117 117
                             break;
118 118
                         default:
119 119
                             // 其他文件
120
-                            $content = "<?php" . PHP_EOL . "namespace {$space};" . PHP_EOL . PHP_EOL . "class {$class}" . PHP_EOL . "{" . PHP_EOL . PHP_EOL . "}";
120
+                            $content = "<?php".PHP_EOL."namespace {$space};".PHP_EOL.PHP_EOL."class {$class}".PHP_EOL."{".PHP_EOL.PHP_EOL."}";
121 121
                     }
122 122
 
123 123
                     if (!is_file($filename)) {
@@ -138,10 +138,10 @@  discard block
 block discarded – undo
138 138
     protected function buildHello(string $appName, string $namespace): void
139 139
     {
140 140
         $suffix   = $this->app->config->get('route.controller_suffix') ? 'Controller' : '';
141
-        $filename = $this->basePath . ($appName ? $appName . DIRECTORY_SEPARATOR : '') . 'controller' . DIRECTORY_SEPARATOR . 'Index' . $suffix . '.php';
141
+        $filename = $this->basePath.($appName ? $appName.DIRECTORY_SEPARATOR : '').'controller'.DIRECTORY_SEPARATOR.'Index'.$suffix.'.php';
142 142
 
143 143
         if (!is_file($filename)) {
144
-            $content = file_get_contents($this->app->getThinkPath() . 'tpl' . DIRECTORY_SEPARATOR . 'default_index.tpl');
144
+            $content = file_get_contents($this->app->getThinkPath().'tpl'.DIRECTORY_SEPARATOR.'default_index.tpl');
145 145
             $content = str_replace(['{%name%}', '{%app%}', '{%layer%}', '{%suffix%}'], [$appName, $namespace, 'controller', $suffix], $content);
146 146
             $this->checkDirBuild(dirname($filename));
147 147
 
@@ -157,15 +157,15 @@  discard block
 block discarded – undo
157 157
      */
158 158
     protected function buildCommon(string $appName): void
159 159
     {
160
-        $appPath = $this->basePath . ($appName ? $appName . DIRECTORY_SEPARATOR : '');
160
+        $appPath = $this->basePath.($appName ? $appName.DIRECTORY_SEPARATOR : '');
161 161
 
162
-        if (!is_file($appPath . 'common.php')) {
163
-            file_put_contents($appPath . 'common.php', "<?php" . PHP_EOL . "// 这是系统自动生成的{$appName}应用公共文件" . PHP_EOL);
162
+        if (!is_file($appPath.'common.php')) {
163
+            file_put_contents($appPath.'common.php', "<?php".PHP_EOL."// 这是系统自动生成的{$appName}应用公共文件".PHP_EOL);
164 164
         }
165 165
 
166 166
         foreach (['event', 'middleware', 'provider'] as $name) {
167
-            if (!is_file($appPath . $name . '.php')) {
168
-                file_put_contents($appPath . $name . '.php', "<?php" . PHP_EOL . "// 这是系统自动生成的{$appName}应用{$name}定义文件" . PHP_EOL . "return [" . PHP_EOL . PHP_EOL . "];" . PHP_EOL);
167
+            if (!is_file($appPath.$name.'.php')) {
168
+                file_put_contents($appPath.$name.'.php', "<?php".PHP_EOL."// 这是系统自动生成的{$appName}应用{$name}定义文件".PHP_EOL."return [".PHP_EOL.PHP_EOL."];".PHP_EOL);
169 169
             }
170 170
         }
171 171
     }
Please login to merge, or discard this patch.
src/think/console/command/make/Validate.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -26,14 +26,14 @@
 block discarded – undo
26 26
 
27 27
     protected function getStub(): string
28 28
     {
29
-        $stubPath = __DIR__ . DIRECTORY_SEPARATOR . 'stubs' . DIRECTORY_SEPARATOR;
29
+        $stubPath = __DIR__.DIRECTORY_SEPARATOR.'stubs'.DIRECTORY_SEPARATOR;
30 30
 
31
-        return $stubPath . 'validate.stub';
31
+        return $stubPath.'validate.stub';
32 32
     }
33 33
 
34 34
     protected function getNamespace(string $app): string
35 35
     {
36
-        return parent::getNamespace($app) . '\\validate';
36
+        return parent::getNamespace($app).'\\validate';
37 37
     }
38 38
 
39 39
 }
Please login to merge, or discard this patch.