@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | |
267 | 267 | foreach ($this->tokens as $token) { |
268 | 268 | foreach ($values as $value) { |
269 | - if ($token === $value || 0 === strpos($token, $value . '=')) { |
|
269 | + if ($token === $value || 0 === strpos($token, $value.'=')) { |
|
270 | 270 | return true; |
271 | 271 | } |
272 | 272 | } |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | $token = array_shift($tokens); |
291 | 291 | |
292 | 292 | foreach ($values as $value) { |
293 | - if ($token === $value || 0 === strpos($token, $value . '=')) { |
|
293 | + if ($token === $value || 0 === strpos($token, $value.'=')) { |
|
294 | 294 | if (false !== $pos = strpos($token, '=')) { |
295 | 295 | return substr($token, $pos + 1); |
296 | 296 | } |
@@ -447,9 +447,9 @@ discard block |
||
447 | 447 | */ |
448 | 448 | public function __toString() |
449 | 449 | { |
450 | - $tokens = array_map(function ($token) { |
|
450 | + $tokens = array_map(function($token) { |
|
451 | 451 | if (preg_match('{^(-[^=]+=)(.+)}', $token, $match)) { |
452 | - return $match[1] . $this->escapeToken($match[2]); |
|
452 | + return $match[1].$this->escapeToken($match[2]); |
|
453 | 453 | } |
454 | 454 | |
455 | 455 | if ($token && '-' !== $token[0]) { |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | $pathname = $this->getPathName($classname); |
41 | 41 | |
42 | 42 | if (is_file($pathname)) { |
43 | - $output->writeln('<error>' . $this->type . ' already exists!</error>'); |
|
43 | + $output->writeln('<error>'.$this->type.' already exists!</error>'); |
|
44 | 44 | return false; |
45 | 45 | } |
46 | 46 | |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | |
51 | 51 | file_put_contents($pathname, $this->buildClass($classname)); |
52 | 52 | |
53 | - $output->writeln('<info>' . $this->type . ' created successfully.</info>'); |
|
53 | + $output->writeln('<info>'.$this->type.' created successfully.</info>'); |
|
54 | 54 | |
55 | 55 | } |
56 | 56 | |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | |
61 | 61 | $namespace = trim(implode('\\', array_slice(explode('\\', $name), 0, -1)), '\\'); |
62 | 62 | |
63 | - $class = str_replace($namespace . '\\', '', $name); |
|
63 | + $class = str_replace($namespace.'\\', '', $name); |
|
64 | 64 | |
65 | 65 | return str_replace(['{%className%}', '{%actionSuffix%}', '{%namespace%}', '{%app_namespace%}'], [ |
66 | 66 | $class, |
@@ -72,16 +72,16 @@ discard block |
||
72 | 72 | |
73 | 73 | protected function getPathName($name) |
74 | 74 | { |
75 | - $name = str_replace(App::getNamespace() . '\\', '', $name); |
|
75 | + $name = str_replace(App::getNamespace().'\\', '', $name); |
|
76 | 76 | |
77 | - return Env::get('app_path') . ltrim(str_replace('\\', '/', $name), '/') . '.php'; |
|
77 | + return Env::get('app_path').ltrim(str_replace('\\', '/', $name), '/').'.php'; |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | protected function getClassName($name) |
81 | 81 | { |
82 | 82 | $appNamespace = App::getNamespace(); |
83 | 83 | |
84 | - if (strpos($name, $appNamespace . '\\') !== false) { |
|
84 | + if (strpos($name, $appNamespace.'\\') !== false) { |
|
85 | 85 | return $name; |
86 | 86 | } |
87 | 87 | |
@@ -99,12 +99,12 @@ discard block |
||
99 | 99 | $name = str_replace('/', '\\', $name); |
100 | 100 | } |
101 | 101 | |
102 | - return $this->getNamespace($appNamespace, $module) . '\\' . $name; |
|
102 | + return $this->getNamespace($appNamespace, $module).'\\'.$name; |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | protected function getNamespace($appNamespace, $module) |
106 | 106 | { |
107 | - return $module ? ($appNamespace . '\\' . $module) : $appNamespace; |
|
107 | + return $module ? ($appNamespace.'\\'.$module) : $appNamespace; |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | } |
@@ -38,15 +38,15 @@ discard block |
||
38 | 38 | Cache::clear('route_cache'); |
39 | 39 | } else { |
40 | 40 | if ($input->getOption('cache')) { |
41 | - $path = App::getRuntimePath() . 'cache'; |
|
41 | + $path = App::getRuntimePath().'cache'; |
|
42 | 42 | } elseif ($input->getOption('log')) { |
43 | - $path = App::getRuntimePath() . 'log'; |
|
43 | + $path = App::getRuntimePath().'log'; |
|
44 | 44 | } else { |
45 | 45 | $path = $input->getOption('path') ?: App::getRuntimePath(); |
46 | 46 | } |
47 | 47 | |
48 | 48 | $rmdir = $input->getOption('dir') ? true : false; |
49 | - $this->clear(rtrim($path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR, $rmdir); |
|
49 | + $this->clear(rtrim($path, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR, $rmdir); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | $output->writeln("<info>Clear Successed</info>"); |
@@ -57,13 +57,13 @@ discard block |
||
57 | 57 | $files = is_dir($path) ? scandir($path) : []; |
58 | 58 | |
59 | 59 | foreach ($files as $file) { |
60 | - if ('.' != $file && '..' != $file && is_dir($path . $file)) { |
|
61 | - array_map('unlink', glob($path . $file . DIRECTORY_SEPARATOR . '*.*')); |
|
60 | + if ('.' != $file && '..' != $file && is_dir($path.$file)) { |
|
61 | + array_map('unlink', glob($path.$file.DIRECTORY_SEPARATOR.'*.*')); |
|
62 | 62 | if ($rmdir) { |
63 | - rmdir($path . $file); |
|
63 | + rmdir($path.$file); |
|
64 | 64 | } |
65 | - } elseif ('.gitignore' != $file && is_file($path . $file)) { |
|
66 | - unlink($path . $file); |
|
65 | + } elseif ('.gitignore' != $file && is_file($path.$file)) { |
|
66 | + unlink($path.$file); |
|
67 | 67 | } |
68 | 68 | } |
69 | 69 | } |
@@ -30,14 +30,14 @@ discard block |
||
30 | 30 | |
31 | 31 | protected function execute(Input $input, Output $output) |
32 | 32 | { |
33 | - if (!is_dir(App::getRuntimePath() . 'schema')) { |
|
34 | - @mkdir(App::getRuntimePath() . 'schema', 0755, true); |
|
33 | + if (!is_dir(App::getRuntimePath().'schema')) { |
|
34 | + @mkdir(App::getRuntimePath().'schema', 0755, true); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | if ($input->hasOption('module')) { |
38 | 38 | $module = $input->getOption('module'); |
39 | 39 | // 读取模型 |
40 | - $path = App::getAppPath() . $module . DIRECTORY_SEPARATOR . 'model'; |
|
40 | + $path = App::getAppPath().$module.DIRECTORY_SEPARATOR.'model'; |
|
41 | 41 | $list = is_dir($path) ? scandir($path) : []; |
42 | 42 | $namespace = App::getNamespace(); |
43 | 43 | |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | if (0 === strpos($file, '.')) { |
46 | 46 | continue; |
47 | 47 | } |
48 | - $class = '\\' . $namespace . '\\' . $module . '\\model\\' . pathinfo($file, PATHINFO_FILENAME); |
|
48 | + $class = '\\'.$namespace.'\\'.$module.'\\model\\'.pathinfo($file, PATHINFO_FILENAME); |
|
49 | 49 | $this->buildModelSchema($class); |
50 | 50 | } |
51 | 51 | |
@@ -63,14 +63,14 @@ discard block |
||
63 | 63 | $tables = Db::getConnection()->getTables($dbName); |
64 | 64 | } elseif (!\think\facade\Config::get('app_multi_module')) { |
65 | 65 | $namespace = App::getNamespace(); |
66 | - $path = App::getAppPath() . 'model'; |
|
66 | + $path = App::getAppPath().'model'; |
|
67 | 67 | $list = is_dir($path) ? scandir($path) : []; |
68 | 68 | |
69 | 69 | foreach ($list as $file) { |
70 | 70 | if (0 === strpos($file, '.')) { |
71 | 71 | continue; |
72 | 72 | } |
73 | - $class = '\\' . $namespace . '\\model\\' . pathinfo($file, PATHINFO_FILENAME); |
|
73 | + $class = '\\'.$namespace.'\\model\\'.pathinfo($file, PATHINFO_FILENAME); |
|
74 | 74 | $this->buildModelSchema($class); |
75 | 75 | } |
76 | 76 | |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | $tables = Db::getConnection()->getTables(); |
81 | 81 | } |
82 | 82 | |
83 | - $db = isset($dbName) ? $dbName . '.' : ''; |
|
83 | + $db = isset($dbName) ? $dbName.'.' : ''; |
|
84 | 84 | $this->buildDataBaseSchema($tables, $db); |
85 | 85 | |
86 | 86 | $output->writeln('<info>Succeed!</info>'); |
@@ -92,27 +92,27 @@ discard block |
||
92 | 92 | if (!$reflect->isAbstract() && $reflect->isSubclassOf('\think\Model')) { |
93 | 93 | $table = $class::getTable(); |
94 | 94 | $dbName = $class::getConfig('database'); |
95 | - $content = '<?php ' . PHP_EOL . 'return '; |
|
95 | + $content = '<?php '.PHP_EOL.'return '; |
|
96 | 96 | $info = $class::getConnection()->getFields($table); |
97 | - $content .= var_export($info, true) . ';'; |
|
97 | + $content .= var_export($info, true).';'; |
|
98 | 98 | |
99 | - file_put_contents(App::getRuntimePath() . 'schema' . DIRECTORY_SEPARATOR . $dbName . '.' . $table . '.php', $content); |
|
99 | + file_put_contents(App::getRuntimePath().'schema'.DIRECTORY_SEPARATOR.$dbName.'.'.$table.'.php', $content); |
|
100 | 100 | } |
101 | 101 | } |
102 | 102 | |
103 | 103 | protected function buildDataBaseSchema($tables, $db) |
104 | 104 | { |
105 | 105 | if ('' == $db) { |
106 | - $dbName = Db::getConfig('database') . '.'; |
|
106 | + $dbName = Db::getConfig('database').'.'; |
|
107 | 107 | } else { |
108 | 108 | $dbName = $db; |
109 | 109 | } |
110 | 110 | |
111 | 111 | foreach ($tables as $table) { |
112 | - $content = '<?php ' . PHP_EOL . 'return '; |
|
113 | - $info = Db::getConnection()->getFields($db . $table); |
|
114 | - $content .= var_export($info, true) . ';'; |
|
115 | - file_put_contents(App::getRuntimePath() . 'schema' . DIRECTORY_SEPARATOR . $dbName . $table . '.php', $content); |
|
112 | + $content = '<?php '.PHP_EOL.'return '; |
|
113 | + $info = Db::getConnection()->getFields($db.$table); |
|
114 | + $content .= var_export($info, true).';'; |
|
115 | + file_put_contents(App::getRuntimePath().'schema'.DIRECTORY_SEPARATOR.$dbName.$table.'.php', $content); |
|
116 | 116 | } |
117 | 117 | } |
118 | 118 | } |
@@ -29,28 +29,28 @@ discard block |
||
29 | 29 | protected function execute(Input $input, Output $output) |
30 | 30 | { |
31 | 31 | if ($input->getArgument('module')) { |
32 | - $module = $input->getArgument('module') . DIRECTORY_SEPARATOR; |
|
32 | + $module = $input->getArgument('module').DIRECTORY_SEPARATOR; |
|
33 | 33 | } else { |
34 | 34 | $module = ''; |
35 | 35 | } |
36 | 36 | |
37 | - $content = '<?php ' . PHP_EOL . $this->buildCacheContent($module); |
|
37 | + $content = '<?php '.PHP_EOL.$this->buildCacheContent($module); |
|
38 | 38 | $runtimePath = App::getRuntimePath(); |
39 | - if (!is_dir($runtimePath . $module)) { |
|
40 | - @mkdir($runtimePath . $module, 0755, true); |
|
39 | + if (!is_dir($runtimePath.$module)) { |
|
40 | + @mkdir($runtimePath.$module, 0755, true); |
|
41 | 41 | } |
42 | 42 | |
43 | - file_put_contents($runtimePath . $module . 'init.php', $content); |
|
43 | + file_put_contents($runtimePath.$module.'init.php', $content); |
|
44 | 44 | |
45 | 45 | $output->writeln('<info>Succeed!</info>'); |
46 | 46 | } |
47 | 47 | |
48 | 48 | protected function buildCacheContent($module) |
49 | 49 | { |
50 | - $content = '// This cache file is automatically generated at:' . date('Y-m-d H:i:s') . PHP_EOL; |
|
51 | - $path = realpath(App::getAppPath() . $module) . DIRECTORY_SEPARATOR; |
|
50 | + $content = '// This cache file is automatically generated at:'.date('Y-m-d H:i:s').PHP_EOL; |
|
51 | + $path = realpath(App::getAppPath().$module).DIRECTORY_SEPARATOR; |
|
52 | 52 | if ($module) { |
53 | - $configPath = is_dir($path . 'config') ? $path . 'config' : App::getConfigPath() . $module; |
|
53 | + $configPath = is_dir($path.'config') ? $path.'config' : App::getConfigPath().$module; |
|
54 | 54 | } else { |
55 | 55 | $configPath = App::getConfigPath(); |
56 | 56 | } |
@@ -60,47 +60,47 @@ discard block |
||
60 | 60 | $files = is_dir($configPath) ? scandir($configPath) : []; |
61 | 61 | |
62 | 62 | foreach ($files as $file) { |
63 | - if ('.' . pathinfo($file, PATHINFO_EXTENSION) === $ext) { |
|
64 | - $filename = $configPath . DIRECTORY_SEPARATOR . $file; |
|
63 | + if ('.'.pathinfo($file, PATHINFO_EXTENSION) === $ext) { |
|
64 | + $filename = $configPath.DIRECTORY_SEPARATOR.$file; |
|
65 | 65 | $config->load($filename, pathinfo($file, PATHINFO_FILENAME)); |
66 | 66 | } |
67 | 67 | } |
68 | 68 | |
69 | 69 | // 加载行为扩展文件 |
70 | - if (is_file($path . 'tags.php')) { |
|
71 | - $tags = include $path . 'tags.php'; |
|
70 | + if (is_file($path.'tags.php')) { |
|
71 | + $tags = include $path.'tags.php'; |
|
72 | 72 | if (is_array($tags)) { |
73 | - $content .= PHP_EOL . '\think\facade\Hook::import(' . (var_export($tags, true)) . ');' . PHP_EOL; |
|
73 | + $content .= PHP_EOL.'\think\facade\Hook::import('.(var_export($tags, true)).');'.PHP_EOL; |
|
74 | 74 | } |
75 | 75 | } |
76 | 76 | |
77 | 77 | // 加载公共文件 |
78 | - if (is_file($path . 'common.php')) { |
|
79 | - $common = substr(php_strip_whitespace($path . 'common.php'), 6); |
|
78 | + if (is_file($path.'common.php')) { |
|
79 | + $common = substr(php_strip_whitespace($path.'common.php'), 6); |
|
80 | 80 | if ($common) { |
81 | - $content .= PHP_EOL . $common . PHP_EOL; |
|
81 | + $content .= PHP_EOL.$common.PHP_EOL; |
|
82 | 82 | } |
83 | 83 | } |
84 | 84 | |
85 | 85 | if ('' == $module) { |
86 | - $content .= PHP_EOL . substr(php_strip_whitespace(App::getThinkPath() . 'helper.php'), 6) . PHP_EOL; |
|
86 | + $content .= PHP_EOL.substr(php_strip_whitespace(App::getThinkPath().'helper.php'), 6).PHP_EOL; |
|
87 | 87 | |
88 | - if (is_file($path . 'middleware.php')) { |
|
89 | - $middleware = include $path . 'middleware.php'; |
|
88 | + if (is_file($path.'middleware.php')) { |
|
89 | + $middleware = include $path.'middleware.php'; |
|
90 | 90 | if (is_array($middleware)) { |
91 | - $content .= PHP_EOL . '\think\Container::get("middleware")->import(' . var_export($middleware, true) . ');' . PHP_EOL; |
|
91 | + $content .= PHP_EOL.'\think\Container::get("middleware")->import('.var_export($middleware, true).');'.PHP_EOL; |
|
92 | 92 | } |
93 | 93 | } |
94 | 94 | } |
95 | 95 | |
96 | - if (is_file($path . 'provider.php')) { |
|
97 | - $provider = include $path . 'provider.php'; |
|
96 | + if (is_file($path.'provider.php')) { |
|
97 | + $provider = include $path.'provider.php'; |
|
98 | 98 | if (is_array($provider)) { |
99 | - $content .= PHP_EOL . '\think\Container::getInstance()->bindTo(' . var_export($provider, true) . ');' . PHP_EOL; |
|
99 | + $content .= PHP_EOL.'\think\Container::getInstance()->bindTo('.var_export($provider, true).');'.PHP_EOL; |
|
100 | 100 | } |
101 | 101 | } |
102 | 102 | |
103 | - $content .= PHP_EOL . '\think\facade\Config::set(' . var_export($config->get(), true) . ');' . PHP_EOL; |
|
103 | + $content .= PHP_EOL.'\think\facade\Config::set('.var_export($config->get(), true).');'.PHP_EOL; |
|
104 | 104 | |
105 | 105 | return $content; |
106 | 106 | } |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | |
26 | 26 | protected function execute(Input $input, Output $output) |
27 | 27 | { |
28 | - $filename = Container::get('app')->getRuntimePath() . 'route.php'; |
|
28 | + $filename = Container::get('app')->getRuntimePath().'route.php'; |
|
29 | 29 | if (is_file($filename)) { |
30 | 30 | unlink($filename); |
31 | 31 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | |
45 | 45 | foreach ($files as $file) { |
46 | 46 | if (strpos($file, '.php')) { |
47 | - $filename = $path . DIRECTORY_SEPARATOR . $file; |
|
47 | + $filename = $path.DIRECTORY_SEPARATOR.$file; |
|
48 | 48 | // 导入路由配置 |
49 | 49 | $rules = include $filename; |
50 | 50 | if (is_array($rules)) { |
@@ -58,8 +58,8 @@ discard block |
||
58 | 58 | include Container::get('build')->buildRoute($suffix); |
59 | 59 | } |
60 | 60 | |
61 | - $content = '<?php ' . PHP_EOL . 'return '; |
|
62 | - $content .= var_export(Container::get('route')->getName(), true) . ';'; |
|
61 | + $content = '<?php '.PHP_EOL.'return '; |
|
62 | + $content .= var_export(Container::get('route')->getName(), true).';'; |
|
63 | 63 | return $content; |
64 | 64 | } |
65 | 65 |
@@ -37,10 +37,10 @@ discard block |
||
37 | 37 | EOF; |
38 | 38 | $app = Container::get('app'); |
39 | 39 | $namespacesToScan = [ |
40 | - $app->getNamespace() . '\\' => realpath(rtrim($app->getAppPath())), |
|
41 | - 'think\\' => $app->getThinkPath() . 'library/think', |
|
42 | - 'traits\\' => $app->getThinkPath() . 'library/traits', |
|
43 | - '' => realpath(rtrim($app->getRootPath() . 'extend')), |
|
40 | + $app->getNamespace().'\\' => realpath(rtrim($app->getAppPath())), |
|
41 | + 'think\\' => $app->getThinkPath().'library/think', |
|
42 | + 'traits\\' => $app->getThinkPath().'library/traits', |
|
43 | + '' => realpath(rtrim($app->getRootPath().'extend')), |
|
44 | 44 | ]; |
45 | 45 | |
46 | 46 | krsort($namespacesToScan); |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | |
58 | 58 | ksort($classMap); |
59 | 59 | foreach ($classMap as $class => $code) { |
60 | - $classmapFile .= ' ' . var_export($class, true) . ' => ' . $code; |
|
60 | + $classmapFile .= ' '.var_export($class, true).' => '.$code; |
|
61 | 61 | } |
62 | 62 | $classmapFile .= "];\n"; |
63 | 63 | $runtimePath = $app->getRuntimePath(); |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | @mkdir($runtimePath, 0755, true); |
66 | 66 | } |
67 | 67 | |
68 | - file_put_contents($runtimePath . 'classmap.php', $classmapFile); |
|
68 | + file_put_contents($runtimePath.'classmap.php', $classmapFile); |
|
69 | 69 | |
70 | 70 | $output->writeln('<info>Succeed!</info>'); |
71 | 71 | } |
@@ -74,16 +74,16 @@ discard block |
||
74 | 74 | { |
75 | 75 | foreach ($this->createMap($dir, $namespace) as $class => $path) { |
76 | 76 | |
77 | - $pathCode = $this->getPathCode($path) . ",\n"; |
|
77 | + $pathCode = $this->getPathCode($path).",\n"; |
|
78 | 78 | |
79 | 79 | if (!isset($classMap[$class])) { |
80 | 80 | $classMap[$class] = $pathCode; |
81 | - } elseif ($classMap[$class] !== $pathCode && !preg_match('{/(test|fixture|example|stub)s?/}i', strtr($classMap[$class] . ' ' . $path, '\\', '/'))) { |
|
81 | + } elseif ($classMap[$class] !== $pathCode && !preg_match('{/(test|fixture|example|stub)s?/}i', strtr($classMap[$class].' '.$path, '\\', '/'))) { |
|
82 | 82 | $this->output->writeln( |
83 | - '<warning>Warning: Ambiguous class resolution, "' . $class . '"' . |
|
84 | - ' was found in both "' . str_replace(["',\n"], [ |
|
83 | + '<warning>Warning: Ambiguous class resolution, "'.$class.'"'. |
|
84 | + ' was found in both "'.str_replace(["',\n"], [ |
|
85 | 85 | '', |
86 | - ], $classMap[$class]) . '" and "' . $path . '", the first will be used.</warning>' |
|
86 | + ], $classMap[$class]).'" and "'.$path.'", the first will be used.</warning>' |
|
87 | 87 | ); |
88 | 88 | } |
89 | 89 | } |
@@ -95,26 +95,26 @@ discard block |
||
95 | 95 | $baseDir = ''; |
96 | 96 | $app = Container::get('app'); |
97 | 97 | $appPath = $this->normalizePath(realpath($app->getAppPath())); |
98 | - $libPath = $this->normalizePath(realpath($app->getThinkPath() . 'library')); |
|
99 | - $extendPath = $this->normalizePath(realpath($app->getRootPath() . 'extend')); |
|
98 | + $libPath = $this->normalizePath(realpath($app->getThinkPath().'library')); |
|
99 | + $extendPath = $this->normalizePath(realpath($app->getRootPath().'extend')); |
|
100 | 100 | $path = $this->normalizePath($path); |
101 | 101 | |
102 | - if (strpos($path, $libPath . '/') === 0) { |
|
103 | - $path = substr($path, strlen($app->getThinkPath() . 'library')); |
|
104 | - $baseDir = "'" . $libPath . "/'"; |
|
105 | - } elseif (strpos($path, $appPath . '/') === 0) { |
|
102 | + if (strpos($path, $libPath.'/') === 0) { |
|
103 | + $path = substr($path, strlen($app->getThinkPath().'library')); |
|
104 | + $baseDir = "'".$libPath."/'"; |
|
105 | + } elseif (strpos($path, $appPath.'/') === 0) { |
|
106 | 106 | $path = substr($path, strlen($appPath) + 1); |
107 | - $baseDir = "'" . $appPath . "/'"; |
|
108 | - } elseif (strpos($path, $extendPath . '/') === 0) { |
|
107 | + $baseDir = "'".$appPath."/'"; |
|
108 | + } elseif (strpos($path, $extendPath.'/') === 0) { |
|
109 | 109 | $path = substr($path, strlen($extendPath) + 1); |
110 | - $baseDir = "'" . $extendPath . "/'"; |
|
110 | + $baseDir = "'".$extendPath."/'"; |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | if (false !== $path) { |
114 | 114 | $baseDir .= " . "; |
115 | 115 | } |
116 | 116 | |
117 | - return $baseDir . ((false !== $path) ? var_export($path, true) : ""); |
|
117 | + return $baseDir.((false !== $path) ? var_export($path, true) : ""); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | protected function normalizePath($path) |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | } |
146 | 146 | } |
147 | 147 | |
148 | - return $prefix . ($absolute ? '/' : '') . implode('/', $parts); |
|
148 | + return $prefix.($absolute ? '/' : '').implode('/', $parts); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | protected function createMap($path, $namespace = null) |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | } |
168 | 168 | } else { |
169 | 169 | throw new \RuntimeException( |
170 | - 'Could not scan for classes inside "' . $path . |
|
170 | + 'Could not scan for classes inside "'.$path. |
|
171 | 171 | '" which does not appear to be a file nor a folder' |
172 | 172 | ); |
173 | 173 | } |
@@ -192,10 +192,10 @@ discard block |
||
192 | 192 | |
193 | 193 | if (!isset($map[$class])) { |
194 | 194 | $map[$class] = $filePath; |
195 | - } elseif ($map[$class] !== $filePath && !preg_match('{/(test|fixture|example|stub)s?/}i', strtr($map[$class] . ' ' . $filePath, '\\', '/'))) { |
|
195 | + } elseif ($map[$class] !== $filePath && !preg_match('{/(test|fixture|example|stub)s?/}i', strtr($map[$class].' '.$filePath, '\\', '/'))) { |
|
196 | 196 | $this->output->writeln( |
197 | - '<warning>Warning: Ambiguous class resolution, "' . $class . '"' . |
|
198 | - ' was found in both "' . $map[$class] . '" and "' . $filePath . '", the first will be used.</warning>' |
|
197 | + '<warning>Warning: Ambiguous class resolution, "'.$class.'"'. |
|
198 | + ' was found in both "'.$map[$class].'" and "'.$filePath.'", the first will be used.</warning>' |
|
199 | 199 | ); |
200 | 200 | } |
201 | 201 | } |
@@ -221,12 +221,12 @@ discard block |
||
221 | 221 | } |
222 | 222 | $error = error_get_last(); |
223 | 223 | if (isset($error['message'])) { |
224 | - $message .= PHP_EOL . 'The following message may be helpful:' . PHP_EOL . $error['message']; |
|
224 | + $message .= PHP_EOL.'The following message may be helpful:'.PHP_EOL.$error['message']; |
|
225 | 225 | } |
226 | 226 | throw new \RuntimeException(sprintf($message, $path)); |
227 | 227 | } |
228 | 228 | |
229 | - if (!preg_match('{\b(?:class|interface' . $extraTypes . ')\s}i', $contents)) { |
|
229 | + if (!preg_match('{\b(?:class|interface'.$extraTypes.')\s}i', $contents)) { |
|
230 | 230 | return []; |
231 | 231 | } |
232 | 232 | |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | |
252 | 252 | preg_match_all('{ |
253 | 253 | (?: |
254 | - \b(?<![\$:>])(?P<type>class|interface' . $extraTypes . ') \s++ (?P<name>[a-zA-Z_\x7f-\xff:][a-zA-Z0-9_\x7f-\xff:\-]*+) |
|
254 | + \b(?<![\$:>])(?P<type>class|interface' . $extraTypes.') \s++ (?P<name>[a-zA-Z_\x7f-\xff:][a-zA-Z0-9_\x7f-\xff:\-]*+) |
|
255 | 255 | | \b(?<![\$:>])(?P<ns>namespace) (?P<nsname>\s++[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+(?:\s*+\\\\\s*+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+)*+)? \s*+ [\{;] |
256 | 256 | ) |
257 | 257 | }ix', $contents, $matches); |
@@ -261,15 +261,15 @@ discard block |
||
261 | 261 | |
262 | 262 | for ($i = 0, $len = count($matches['type']); $i < $len; $i++) { |
263 | 263 | if (!empty($matches['ns'][$i])) { |
264 | - $namespace = str_replace([' ', "\t", "\r", "\n"], '', $matches['nsname'][$i]) . '\\'; |
|
264 | + $namespace = str_replace([' ', "\t", "\r", "\n"], '', $matches['nsname'][$i]).'\\'; |
|
265 | 265 | } else { |
266 | 266 | $name = $matches['name'][$i]; |
267 | 267 | if (':' === $name[0]) { |
268 | - $name = 'xhp' . substr(str_replace(['-', ':'], ['_', '__'], $name), 1); |
|
268 | + $name = 'xhp'.substr(str_replace(['-', ':'], ['_', '__'], $name), 1); |
|
269 | 269 | } elseif ('enum' === $matches['type'][$i]) { |
270 | 270 | $name = rtrim($name, ':'); |
271 | 271 | } |
272 | - $classes[] = ltrim($namespace . $name, '\\'); |
|
272 | + $classes[] = ltrim($namespace.$name, '\\'); |
|
273 | 273 | } |
274 | 274 | } |
275 | 275 |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | ->addOption('port', 'p', Option::VALUE_OPTIONAL, |
27 | 27 | 'The port to server the application on', 8000) |
28 | 28 | ->addOption('root', 'r', Option::VALUE_OPTIONAL, |
29 | - 'The document root of the application', App::getRootPath() . 'public') |
|
29 | + 'The document root of the application', App::getRootPath().'public') |
|
30 | 30 | ->setDescription('PHP Built-in Server for ThinkPHP'); |
31 | 31 | } |
32 | 32 | |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | $host, |
42 | 42 | $port, |
43 | 43 | escapeshellarg($root), |
44 | - escapeshellarg($root . DIRECTORY_SEPARATOR . 'router.php') |
|
44 | + escapeshellarg($root.DIRECTORY_SEPARATOR.'router.php') |
|
45 | 45 | ); |
46 | 46 | |
47 | 47 | $output->writeln(sprintf('ThinkPHP Development server is started On <http://%s:%s/>', $host, $port)); |
@@ -26,6 +26,6 @@ |
||
26 | 26 | |
27 | 27 | protected function execute(Input $input, Output $output) |
28 | 28 | { |
29 | - $output->writeln('v' . App::version()); |
|
29 | + $output->writeln('v'.App::version()); |
|
30 | 30 | } |
31 | 31 | } |