@@ -8,7 +8,7 @@ discard block |
||
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\route\dispatch; |
14 | 14 | |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | |
55 | 55 | if (strpos($controller, '.')) { |
56 | 56 | $pos = strrpos($controller, '.'); |
57 | - $this->controller = substr($controller, 0, $pos) . '.' . Str::studly(substr($controller, $pos + 1)); |
|
57 | + $this->controller = substr($controller, 0, $pos).'.'.Str::studly(substr($controller, $pos + 1)); |
|
58 | 58 | } else { |
59 | 59 | $this->controller = Str::studly($controller); |
60 | 60 | } |
@@ -74,15 +74,15 @@ discard block |
||
74 | 74 | // 实例化控制器 |
75 | 75 | $instance = $this->controller($this->controller); |
76 | 76 | } catch (ClassNotFoundException $e) { |
77 | - throw new HttpException(404, 'controller not exists:' . $e->getClass()); |
|
77 | + throw new HttpException(404, 'controller not exists:'.$e->getClass()); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | // 注册控制器中间件 |
81 | 81 | $this->registerControllerMiddleware($instance); |
82 | 82 | |
83 | - $this->app->middleware->controller(function (Request $request, $next) use ($instance) { |
|
83 | + $this->app->middleware->controller(function(Request $request, $next) use ($instance) { |
|
84 | 84 | // 获取当前操作名 |
85 | - $action = $this->actionName . $this->rule->config('action_suffix'); |
|
85 | + $action = $this->actionName.$this->rule->config('action_suffix'); |
|
86 | 86 | |
87 | 87 | if (is_callable([$instance, $action])) { |
88 | 88 | $vars = $this->request->param(); |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | } |
99 | 99 | } else { |
100 | 100 | // 操作不存在 |
101 | - throw new HttpException(404, 'method not exists:' . get_class($instance) . '->' . $action . '()'); |
|
101 | + throw new HttpException(404, 'method not exists:'.get_class($instance).'->'.$action.'()'); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | $data = $this->app->invokeReflectMethod($instance, $reflect, $vars); |
@@ -127,11 +127,11 @@ discard block |
||
127 | 127 | |
128 | 128 | foreach ($middlewares as $key => $val) { |
129 | 129 | if (!is_int($key)) { |
130 | - if (isset($val['only']) && !in_array($this->request->action(true), array_map(function ($item) { |
|
130 | + if (isset($val['only']) && !in_array($this->request->action(true), array_map(function($item) { |
|
131 | 131 | return strtolower($item); |
132 | 132 | }, $val['only']))) { |
133 | 133 | continue; |
134 | - } elseif (isset($val['except']) && in_array($this->request->action(true), array_map(function ($item) { |
|
134 | + } elseif (isset($val['except']) && in_array($this->request->action(true), array_map(function($item) { |
|
135 | 135 | return strtolower($item); |
136 | 136 | }, $val['except']))) { |
137 | 137 | continue; |
@@ -159,14 +159,14 @@ discard block |
||
159 | 159 | $controllerLayer = $this->rule->config('controller_layer') ?: 'controller'; |
160 | 160 | $emptyController = $this->rule->config('empty_controller') ?: 'Error'; |
161 | 161 | |
162 | - $class = $this->app->parseClass($controllerLayer, $name . $suffix); |
|
162 | + $class = $this->app->parseClass($controllerLayer, $name.$suffix); |
|
163 | 163 | |
164 | 164 | if (class_exists($class)) { |
165 | 165 | return $this->app->make($class, [], true); |
166 | - } elseif ($emptyController && class_exists($emptyClass = $this->app->parseClass($controllerLayer, $emptyController . $suffix))) { |
|
166 | + } elseif ($emptyController && class_exists($emptyClass = $this->app->parseClass($controllerLayer, $emptyController.$suffix))) { |
|
167 | 167 | return $this->app->make($emptyClass, [], true); |
168 | 168 | } |
169 | 169 | |
170 | - throw new ClassNotFoundException('class not exists:' . $class, $class); |
|
170 | + throw new ClassNotFoundException('class not exists:'.$class, $class); |
|
171 | 171 | } |
172 | 172 | } |
@@ -8,7 +8,7 @@ discard block |
||
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\view\driver; |
14 | 14 | |
@@ -78,14 +78,14 @@ discard block |
||
78 | 78 | |
79 | 79 | // 模板不存在 抛出异常 |
80 | 80 | if (!is_file($template)) { |
81 | - throw new TemplateNotFoundException('template not exists:' . $template, $template); |
|
81 | + throw new TemplateNotFoundException('template not exists:'.$template, $template); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | $this->template = $template; |
85 | 85 | |
86 | 86 | // 记录视图信息 |
87 | 87 | $this->app->log |
88 | - ->record('[ VIEW ] ' . $template . ' [ ' . var_export(array_keys($data), true) . ' ]'); |
|
88 | + ->record('[ VIEW ] '.$template.' [ '.var_export(array_keys($data), true).' ]'); |
|
89 | 89 | |
90 | 90 | extract($data, EXTR_OVERWRITE); |
91 | 91 | |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | $this->content = $content; |
105 | 105 | |
106 | 106 | extract($data, EXTR_OVERWRITE); |
107 | - eval('?>' . $this->content); |
|
107 | + eval('?>'.$this->content); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | /** |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | private function parseTemplate(string $template): string |
117 | 117 | { |
118 | 118 | if (empty($this->config['view_base'])) { |
119 | - $this->config['view_base'] = $this->app->getRootPath() . 'view' . DIRECTORY_SEPARATOR; |
|
119 | + $this->config['view_base'] = $this->app->getRootPath().'view'.DIRECTORY_SEPARATOR; |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | $request = $this->app->request; |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | } else { |
133 | 133 | $app = isset($app) ? $app : $request->app(); |
134 | 134 | // 基础视图目录 |
135 | - $path = $this->config['view_base'] . ($app ? $app . DIRECTORY_SEPARATOR : ''); |
|
135 | + $path = $this->config['view_base'].($app ? $app.DIRECTORY_SEPARATOR : ''); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | $depr = $this->config['view_depr']; |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | $controller = $request->controller(); |
143 | 143 | if (strpos($controller, '.')) { |
144 | 144 | $pos = strrpos($controller, '.'); |
145 | - $controller = substr($controller, 0, $pos) . '.' . Str::snake(substr($controller, $pos + 1)); |
|
145 | + $controller = substr($controller, 0, $pos).'.'.Str::snake(substr($controller, $pos + 1)); |
|
146 | 146 | } else { |
147 | 147 | $controller = Str::snake($controller); |
148 | 148 | } |
@@ -158,16 +158,16 @@ discard block |
||
158 | 158 | $template = App::parseName($request->action()); |
159 | 159 | } |
160 | 160 | |
161 | - $template = str_replace('.', DIRECTORY_SEPARATOR, $controller) . $depr . $template; |
|
161 | + $template = str_replace('.', DIRECTORY_SEPARATOR, $controller).$depr.$template; |
|
162 | 162 | } elseif (false === strpos($template, $depr)) { |
163 | - $template = str_replace('.', DIRECTORY_SEPARATOR, $controller) . $depr . $template; |
|
163 | + $template = str_replace('.', DIRECTORY_SEPARATOR, $controller).$depr.$template; |
|
164 | 164 | } |
165 | 165 | } |
166 | 166 | } else { |
167 | 167 | $template = str_replace(['/', ':'], $depr, substr($template, 1)); |
168 | 168 | } |
169 | 169 | |
170 | - return $path . ltrim($template, '/') . '.' . ltrim($this->config['view_suffix'], '.'); |
|
170 | + return $path.ltrim($template, '/').'.'.ltrim($this->config['view_suffix'], '.'); |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | /** |
@@ -8,7 +8,7 @@ discard block |
||
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\cache; |
14 | 14 | |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | */ |
85 | 85 | public function getCacheKey(string $name): string |
86 | 86 | { |
87 | - return $this->options['prefix'] . $name; |
|
87 | + return $this->options['prefix'].$name; |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | /** |
@@ -145,14 +145,14 @@ discard block |
||
145 | 145 | |
146 | 146 | $time = time(); |
147 | 147 | |
148 | - while ($time + 5 > time() && $this->has($name . '_lock')) { |
|
148 | + while ($time + 5 > time() && $this->has($name.'_lock')) { |
|
149 | 149 | // 存在锁定则等待 |
150 | 150 | usleep(200000); |
151 | 151 | } |
152 | 152 | |
153 | 153 | try { |
154 | 154 | // 锁定 |
155 | - $this->set($name . '_lock', true); |
|
155 | + $this->set($name.'_lock', true); |
|
156 | 156 | |
157 | 157 | if ($value instanceof Closure) { |
158 | 158 | // 获取缓存数据 |
@@ -163,9 +163,9 @@ discard block |
||
163 | 163 | $this->set($name, $value, $expire); |
164 | 164 | |
165 | 165 | // 解锁 |
166 | - $this->delete($name . '_lock'); |
|
166 | + $this->delete($name.'_lock'); |
|
167 | 167 | } catch (Exception | throwable $e) { |
168 | - $this->delete($name . '_lock'); |
|
168 | + $this->delete($name.'_lock'); |
|
169 | 169 | throw $e; |
170 | 170 | } |
171 | 171 | |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | $key = implode('-', $name); |
185 | 185 | |
186 | 186 | if (!isset($this->tag[$key])) { |
187 | - $name = array_map(function ($val) { |
|
187 | + $name = array_map(function($val) { |
|
188 | 188 | return $this->getTagKey($val); |
189 | 189 | }, $name); |
190 | 190 | $this->tag[$key] = new TagSet($name, $this); |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | */ |
213 | 213 | public function getTagKey(string $tag): string |
214 | 214 | { |
215 | - return $this->options['tag_prefix'] . md5($tag); |
|
215 | + return $this->options['tag_prefix'].md5($tag); |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | /** |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | // +---------------------------------------------------------------------- |
7 | 7 | // | Author: zhangyajun <[email protected]> |
8 | 8 | // +---------------------------------------------------------------------- |
9 | -declare (strict_types = 1); |
|
9 | +declare(strict_types=1); |
|
10 | 10 | |
11 | 11 | namespace think; |
12 | 12 | |
@@ -461,10 +461,10 @@ discard block |
||
461 | 461 | public function findNamespace(string $namespace): string |
462 | 462 | { |
463 | 463 | $allNamespaces = $this->getNamespaces(); |
464 | - $expr = preg_replace_callback('{([^:]+|)}', function ($matches) { |
|
465 | - return preg_quote($matches[1]) . '[^:]*'; |
|
464 | + $expr = preg_replace_callback('{([^:]+|)}', function($matches) { |
|
465 | + return preg_quote($matches[1]).'[^:]*'; |
|
466 | 466 | }, $namespace); |
467 | - $namespaces = preg_grep('{^' . $expr . '}', $allNamespaces); |
|
467 | + $namespaces = preg_grep('{^'.$expr.'}', $allNamespaces); |
|
468 | 468 | |
469 | 469 | if (empty($namespaces)) { |
470 | 470 | $message = sprintf('There are no commands defined in the "%s" namespace.', $namespace); |
@@ -501,13 +501,13 @@ discard block |
||
501 | 501 | { |
502 | 502 | $allCommands = array_keys($this->commands); |
503 | 503 | |
504 | - $expr = preg_replace_callback('{([^:]+|)}', function ($matches) { |
|
505 | - return preg_quote($matches[1]) . '[^:]*'; |
|
504 | + $expr = preg_replace_callback('{([^:]+|)}', function($matches) { |
|
505 | + return preg_quote($matches[1]).'[^:]*'; |
|
506 | 506 | }, $name); |
507 | 507 | |
508 | - $commands = preg_grep('{^' . $expr . '}', $allCommands); |
|
508 | + $commands = preg_grep('{^'.$expr.'}', $allCommands); |
|
509 | 509 | |
510 | - if (empty($commands) || count(preg_grep('{^' . $expr . '$}', $commands)) < 1) { |
|
510 | + if (empty($commands) || count(preg_grep('{^'.$expr.'$}', $commands)) < 1) { |
|
511 | 511 | if (false !== $pos = strrpos($name, ':')) { |
512 | 512 | $this->findNamespace(substr($name, 0, $pos)); |
513 | 513 | } |
@@ -701,7 +701,7 @@ discard block |
||
701 | 701 | } |
702 | 702 | } |
703 | 703 | |
704 | - $alternatives = array_filter($alternatives, function ($lev) use ($threshold) { |
|
704 | + $alternatives = array_filter($alternatives, function($lev) use ($threshold) { |
|
705 | 705 | return $lev < 2 * $threshold; |
706 | 706 | }); |
707 | 707 | asort($alternatives); |
@@ -722,7 +722,7 @@ discard block |
||
722 | 722 | |
723 | 723 | foreach ($parts as $part) { |
724 | 724 | if (count($namespaces)) { |
725 | - $namespaces[] = end($namespaces) . ':' . $part; |
|
725 | + $namespaces[] = end($namespaces).':'.$part; |
|
726 | 726 | } else { |
727 | 727 | $namespaces[] = $part; |
728 | 728 | } |
@@ -31,14 +31,14 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -8,7 +8,7 @@ discard block |
||
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; |
14 | 14 | |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | public function __construct(App $app) |
58 | 58 | { |
59 | 59 | $this->app = $app; |
60 | - $this->multi = is_dir($this->app->getBasePath() . 'controller') ? false : true; |
|
60 | + $this->multi = is_dir($this->app->getBasePath().'controller') ? false : true; |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | /** |
@@ -173,8 +173,8 @@ discard block |
||
173 | 173 | $this->initialize(); |
174 | 174 | |
175 | 175 | // 加载全局中间件 |
176 | - if (is_file($this->app->getBasePath() . 'middleware.php')) { |
|
177 | - $this->app->middleware->import(include $this->app->getBasePath() . 'middleware.php'); |
|
176 | + if (is_file($this->app->getBasePath().'middleware.php')) { |
|
177 | + $this->app->middleware->import(include $this->app->getBasePath().'middleware.php'); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | if ($this->multi) { |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | // 监听HttpRun |
188 | 188 | $this->app->event->trigger('HttpRun'); |
189 | 189 | |
190 | - $withRoute = $this->app->config->get('app.with_route', true) ? function () { |
|
190 | + $withRoute = $this->app->config->get('app.with_route', true) ? function() { |
|
191 | 191 | $this->loadRoutes(); |
192 | 192 | } : null; |
193 | 193 | |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | $routePath = $this->getRoutePath(); |
206 | 206 | |
207 | 207 | if (is_dir($routePath)) { |
208 | - $files = glob($routePath . '*.php'); |
|
208 | + $files = glob($routePath.'*.php'); |
|
209 | 209 | foreach ($files as $file) { |
210 | 210 | include $file; |
211 | 211 | } |
@@ -221,11 +221,11 @@ discard block |
||
221 | 221 | */ |
222 | 222 | protected function getRoutePath(): string |
223 | 223 | { |
224 | - if ($this->isMulti() && is_dir($this->app->getAppPath() . 'route')) { |
|
225 | - return $this->app->getAppPath() . 'route' . DIRECTORY_SEPARATOR; |
|
224 | + if ($this->isMulti() && is_dir($this->app->getAppPath().'route')) { |
|
225 | + return $this->app->getAppPath().'route'.DIRECTORY_SEPARATOR; |
|
226 | 226 | } |
227 | 227 | |
228 | - return $this->app->getRootPath() . 'route' . DIRECTORY_SEPARATOR . ($this->isMulti() ? $this->getName() . DIRECTORY_SEPARATOR : ''); |
|
228 | + return $this->app->getRootPath().'route'.DIRECTORY_SEPARATOR.($this->isMulti() ? $this->getName().DIRECTORY_SEPARATOR : ''); |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | /** |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | $appName = $map[$name]; |
311 | 311 | } |
312 | 312 | } elseif ($name && (false !== array_search($name, $map) || in_array($name, $deny))) { |
313 | - throw new HttpException(404, 'app not exists:' . $name); |
|
313 | + throw new HttpException(404, 'app not exists:'.$name); |
|
314 | 314 | } elseif ($name && isset($map['*'])) { |
315 | 315 | $appName = $map['*']; |
316 | 316 | } else { |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | } |
319 | 319 | |
320 | 320 | if ($name) { |
321 | - $this->app->request->setRoot('/' . $name); |
|
321 | + $this->app->request->setRoot('/'.$name); |
|
322 | 322 | $this->app->request->setPathinfo(strpos($path, '/') ? ltrim(strstr($path, '/'), '/') : ''); |
323 | 323 | } |
324 | 324 | } |
@@ -338,41 +338,41 @@ discard block |
||
338 | 338 | { |
339 | 339 | $this->name = $appName; |
340 | 340 | $this->app->request->setApp($appName); |
341 | - $this->app->setAppPath($this->path ?: $this->app->getBasePath() . $appName . DIRECTORY_SEPARATOR); |
|
342 | - $this->app->setRuntimePath($this->app->getRootPath() . 'runtime' . DIRECTORY_SEPARATOR . $appName . DIRECTORY_SEPARATOR); |
|
341 | + $this->app->setAppPath($this->path ?: $this->app->getBasePath().$appName.DIRECTORY_SEPARATOR); |
|
342 | + $this->app->setRuntimePath($this->app->getRootPath().'runtime'.DIRECTORY_SEPARATOR.$appName.DIRECTORY_SEPARATOR); |
|
343 | 343 | |
344 | 344 | //加载app文件 |
345 | 345 | if (is_dir($this->app->getAppPath())) { |
346 | 346 | $appPath = $this->app->getAppPath(); |
347 | 347 | |
348 | - if (is_file($appPath . 'common.php')) { |
|
349 | - include_once $appPath . 'common.php'; |
|
348 | + if (is_file($appPath.'common.php')) { |
|
349 | + include_once $appPath.'common.php'; |
|
350 | 350 | } |
351 | 351 | |
352 | 352 | $configPath = $this->app->getConfigPath(); |
353 | 353 | |
354 | 354 | $files = []; |
355 | 355 | |
356 | - if (is_dir($configPath . $appName)) { |
|
357 | - $files = array_merge($files, glob($configPath . $appName . DIRECTORY_SEPARATOR . '*' . $this->app->getConfigExt())); |
|
358 | - } elseif (is_dir($appPath . 'config')) { |
|
359 | - $files = array_merge($files, glob($appPath . 'config' . DIRECTORY_SEPARATOR . '*' . $this->app->getConfigExt())); |
|
356 | + if (is_dir($configPath.$appName)) { |
|
357 | + $files = array_merge($files, glob($configPath.$appName.DIRECTORY_SEPARATOR.'*'.$this->app->getConfigExt())); |
|
358 | + } elseif (is_dir($appPath.'config')) { |
|
359 | + $files = array_merge($files, glob($appPath.'config'.DIRECTORY_SEPARATOR.'*'.$this->app->getConfigExt())); |
|
360 | 360 | } |
361 | 361 | |
362 | 362 | foreach ($files as $file) { |
363 | 363 | $this->app->config->load($file, pathinfo($file, PATHINFO_FILENAME)); |
364 | 364 | } |
365 | 365 | |
366 | - if (is_file($appPath . 'event.php')) { |
|
367 | - $this->app->loadEvent(include $appPath . 'event.php'); |
|
366 | + if (is_file($appPath.'event.php')) { |
|
367 | + $this->app->loadEvent(include $appPath.'event.php'); |
|
368 | 368 | } |
369 | 369 | |
370 | - if (is_file($appPath . 'middleware.php')) { |
|
371 | - $this->app->middleware->import(include $appPath . 'middleware.php'); |
|
370 | + if (is_file($appPath.'middleware.php')) { |
|
371 | + $this->app->middleware->import(include $appPath.'middleware.php'); |
|
372 | 372 | } |
373 | 373 | |
374 | - if (is_file($appPath . 'provider.php')) { |
|
375 | - $this->app->bind(include $appPath . 'provider.php'); |
|
374 | + if (is_file($appPath.'provider.php')) { |
|
375 | + $this->app->bind(include $appPath.'provider.php'); |
|
376 | 376 | } |
377 | 377 | } |
378 | 378 | |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | $this->app->loadLangPack($this->app->lang->defaultLangSet()); |
381 | 381 | |
382 | 382 | // 设置应用命名空间 |
383 | - $this->app->setNamespace($this->app->config->get('app.app_namespace') ?: 'app\\' . $appName); |
|
383 | + $this->app->setNamespace($this->app->config->get('app.app_namespace') ?: 'app\\'.$appName); |
|
384 | 384 | } |
385 | 385 | |
386 | 386 | /** |