@@ -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 RuntimeException('template not exists:' . $template); |
|
81 | + throw new RuntimeException('template not exists:'.$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 | /** |
@@ -129,10 +129,10 @@ discard block |
||
129 | 129 | $appName = isset($app) ? $app : $this->app->http->getName(); |
130 | 130 | $view = $this->config['view_dir_name']; |
131 | 131 | |
132 | - if (is_dir($this->app->getAppPath() . $view)) { |
|
133 | - $path = isset($app) ? $this->app->getBasePath() . ($appName ? $appName . DIRECTORY_SEPARATOR : '') . $view . DIRECTORY_SEPARATOR : $this->app->getAppPath() . $view . DIRECTORY_SEPARATOR; |
|
132 | + if (is_dir($this->app->getAppPath().$view)) { |
|
133 | + $path = isset($app) ? $this->app->getBasePath().($appName ? $appName.DIRECTORY_SEPARATOR : '').$view.DIRECTORY_SEPARATOR : $this->app->getAppPath().$view.DIRECTORY_SEPARATOR; |
|
134 | 134 | } else { |
135 | - $path = $this->app->getRootPath() . $view . DIRECTORY_SEPARATOR . ($appName ? $appName . DIRECTORY_SEPARATOR : ''); |
|
135 | + $path = $this->app->getRootPath().$view.DIRECTORY_SEPARATOR.($appName ? $appName.DIRECTORY_SEPARATOR : ''); |
|
136 | 136 | } |
137 | 137 | } |
138 | 138 | |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | $controller = $request->controller(); |
144 | 144 | if (strpos($controller, '.')) { |
145 | 145 | $pos = strrpos($controller, '.'); |
146 | - $controller = substr($controller, 0, $pos) . '.' . Str::snake(substr($controller, $pos + 1)); |
|
146 | + $controller = substr($controller, 0, $pos).'.'.Str::snake(substr($controller, $pos + 1)); |
|
147 | 147 | } else { |
148 | 148 | $controller = Str::snake($controller); |
149 | 149 | } |
@@ -159,16 +159,16 @@ discard block |
||
159 | 159 | $template = Str::snake($request->action()); |
160 | 160 | } |
161 | 161 | |
162 | - $template = str_replace('.', DIRECTORY_SEPARATOR, $controller) . $depr . $template; |
|
162 | + $template = str_replace('.', DIRECTORY_SEPARATOR, $controller).$depr.$template; |
|
163 | 163 | } elseif (false === strpos($template, $depr)) { |
164 | - $template = str_replace('.', DIRECTORY_SEPARATOR, $controller) . $depr . $template; |
|
164 | + $template = str_replace('.', DIRECTORY_SEPARATOR, $controller).$depr.$template; |
|
165 | 165 | } |
166 | 166 | } |
167 | 167 | } else { |
168 | 168 | $template = str_replace(['/', ':'], $depr, substr($template, 1)); |
169 | 169 | } |
170 | 170 | |
171 | - return $path . ltrim($template, '/') . '.' . ltrim($this->config['view_suffix'], '.'); |
|
171 | + return $path.ltrim($template, '/').'.'.ltrim($this->config['view_suffix'], '.'); |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | /** |
@@ -48,21 +48,21 @@ discard block |
||
48 | 48 | $tables = $this->app->db->getConnection()->getTables($dbName); |
49 | 49 | } else { |
50 | 50 | if ($dir) { |
51 | - $appPath = $this->app->getBasePath() . $dir . DIRECTORY_SEPARATOR; |
|
52 | - $namespace = 'app\\' . $dir; |
|
51 | + $appPath = $this->app->getBasePath().$dir.DIRECTORY_SEPARATOR; |
|
52 | + $namespace = 'app\\'.$dir; |
|
53 | 53 | } else { |
54 | 54 | $appPath = $this->app->getBasePath(); |
55 | 55 | $namespace = 'app'; |
56 | 56 | } |
57 | 57 | |
58 | - $path = $appPath . 'model'; |
|
58 | + $path = $appPath.'model'; |
|
59 | 59 | $list = is_dir($path) ? scandir($path) : []; |
60 | 60 | |
61 | 61 | foreach ($list as $file) { |
62 | 62 | if (0 === strpos($file, '.')) { |
63 | 63 | continue; |
64 | 64 | } |
65 | - $class = '\\' . $namespace . '\\model\\' . pathinfo($file, PATHINFO_FILENAME); |
|
65 | + $class = '\\'.$namespace.'\\model\\'.pathinfo($file, PATHINFO_FILENAME); |
|
66 | 66 | $this->buildModelSchema($class); |
67 | 67 | } |
68 | 68 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | return; |
71 | 71 | } |
72 | 72 | |
73 | - $db = isset($dbName) ? $dbName . '.' : ''; |
|
73 | + $db = isset($dbName) ? $dbName.'.' : ''; |
|
74 | 74 | $this->buildDataBaseSchema($schemaPath, $tables, $db); |
75 | 75 | |
76 | 76 | $output->writeln('<info>Succeed!</info>'); |
@@ -89,27 +89,27 @@ discard block |
||
89 | 89 | if (!is_dir($path)) { |
90 | 90 | mkdir($path, 0755, true); |
91 | 91 | } |
92 | - $content = '<?php ' . PHP_EOL . 'return '; |
|
92 | + $content = '<?php '.PHP_EOL.'return '; |
|
93 | 93 | $info = $model->db()->getConnection()->getTableFieldsInfo($table); |
94 | - $content .= var_export($info, true) . ';'; |
|
94 | + $content .= var_export($info, true).';'; |
|
95 | 95 | |
96 | - file_put_contents($path . $dbName . '.' . $table . '.php', $content); |
|
96 | + file_put_contents($path.$dbName.'.'.$table.'.php', $content); |
|
97 | 97 | } |
98 | 98 | } |
99 | 99 | |
100 | 100 | protected function buildDataBaseSchema(string $path, array $tables, string $db): void |
101 | 101 | { |
102 | 102 | if ('' == $db) { |
103 | - $dbName = $this->app->db->getConnection()->getConfig('database') . '.'; |
|
103 | + $dbName = $this->app->db->getConnection()->getConfig('database').'.'; |
|
104 | 104 | } else { |
105 | 105 | $dbName = $db; |
106 | 106 | } |
107 | 107 | |
108 | 108 | foreach ($tables as $table) { |
109 | - $content = '<?php ' . PHP_EOL . 'return '; |
|
110 | - $info = $this->app->db->getConnection()->getTableFieldsInfo($db . $table); |
|
111 | - $content .= var_export($info, true) . ';'; |
|
112 | - file_put_contents($path . $dbName . $table . '.php', $content); |
|
109 | + $content = '<?php '.PHP_EOL.'return '; |
|
110 | + $info = $this->app->db->getConnection()->getTableFieldsInfo($db.$table); |
|
111 | + $content .= var_export($info, true).';'; |
|
112 | + file_put_contents($path.$dbName.$table.'.php', $content); |
|
113 | 113 | } |
114 | 114 | } |
115 | 115 | } |
@@ -29,9 +29,9 @@ discard block |
||
29 | 29 | { |
30 | 30 | $dir = $input->getArgument('dir') ?: ''; |
31 | 31 | |
32 | - $path = $this->app->getRootPath() . 'runtime' . DIRECTORY_SEPARATOR . ($dir ? $dir . DIRECTORY_SEPARATOR : ''); |
|
32 | + $path = $this->app->getRootPath().'runtime'.DIRECTORY_SEPARATOR.($dir ? $dir.DIRECTORY_SEPARATOR : ''); |
|
33 | 33 | |
34 | - $filename = $path . 'route.php'; |
|
34 | + $filename = $path.'route.php'; |
|
35 | 35 | if (is_file($filename)) { |
36 | 36 | unlink($filename); |
37 | 37 | } |
@@ -46,21 +46,21 @@ discard block |
||
46 | 46 | $this->app->route->lazy(false); |
47 | 47 | |
48 | 48 | // 路由检测 |
49 | - $path = $this->app->getRootPath() . 'route' . DIRECTORY_SEPARATOR . ($dir ? $dir . DIRECTORY_SEPARATOR : ''); |
|
49 | + $path = $this->app->getRootPath().'route'.DIRECTORY_SEPARATOR.($dir ? $dir.DIRECTORY_SEPARATOR : ''); |
|
50 | 50 | |
51 | 51 | $files = is_dir($path) ? scandir($path) : []; |
52 | 52 | |
53 | 53 | foreach ($files as $file) { |
54 | 54 | if (strpos($file, '.php')) { |
55 | - include $path . $file; |
|
55 | + include $path.$file; |
|
56 | 56 | } |
57 | 57 | } |
58 | 58 | |
59 | 59 | //触发路由载入完成事件 |
60 | 60 | $this->app->event->trigger(RouteLoaded::class); |
61 | 61 | |
62 | - $content = '<?php ' . PHP_EOL . 'return '; |
|
63 | - $content .= '\Opis\Closure\unserialize(\'' . \Opis\Closure\serialize($this->app->route->getName()) . '\');'; |
|
62 | + $content = '<?php '.PHP_EOL.'return '; |
|
63 | + $content .= '\Opis\Closure\unserialize(\''.\Opis\Closure\serialize($this->app->route->getName()).'\');'; |
|
64 | 64 | return $content; |
65 | 65 | } |
66 | 66 |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | { |
43 | 43 | $dir = $input->getArgument('dir') ?: ''; |
44 | 44 | |
45 | - $filename = $this->app->getRootPath() . 'runtime' . DIRECTORY_SEPARATOR . ($dir ? $dir . DIRECTORY_SEPARATOR : '') . 'route_list.php'; |
|
45 | + $filename = $this->app->getRootPath().'runtime'.DIRECTORY_SEPARATOR.($dir ? $dir.DIRECTORY_SEPARATOR : '').'route_list.php'; |
|
46 | 46 | |
47 | 47 | if (is_file($filename)) { |
48 | 48 | unlink($filename); |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | } |
52 | 52 | |
53 | 53 | $content = $this->getRouteList($dir); |
54 | - file_put_contents($filename, 'Route List' . PHP_EOL . $content); |
|
54 | + file_put_contents($filename, 'Route List'.PHP_EOL.$content); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | protected function getRouteList(string $dir = null): string |
@@ -60,16 +60,16 @@ discard block |
||
60 | 60 | $this->app->route->clear(); |
61 | 61 | |
62 | 62 | if ($dir) { |
63 | - $path = $this->app->getRootPath() . 'route' . DIRECTORY_SEPARATOR . $dir . DIRECTORY_SEPARATOR; |
|
63 | + $path = $this->app->getRootPath().'route'.DIRECTORY_SEPARATOR.$dir.DIRECTORY_SEPARATOR; |
|
64 | 64 | } else { |
65 | - $path = $this->app->getRootPath() . 'route' . DIRECTORY_SEPARATOR; |
|
65 | + $path = $this->app->getRootPath().'route'.DIRECTORY_SEPARATOR; |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | $files = is_dir($path) ? scandir($path) : []; |
69 | 69 | |
70 | 70 | foreach ($files as $file) { |
71 | 71 | if (strpos($file, '.php')) { |
72 | - include $path . $file; |
|
72 | + include $path.$file; |
|
73 | 73 | } |
74 | 74 | } |
75 | 75 | |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | $sort = $this->sortBy[$sort]; |
109 | 109 | } |
110 | 110 | |
111 | - uasort($rows, function ($a, $b) use ($sort) { |
|
111 | + uasort($rows, function($a, $b) use ($sort) { |
|
112 | 112 | $itemA = $a[$sort] ?? null; |
113 | 113 | $itemB = $b[$sort] ?? null; |
114 | 114 |
@@ -64,9 +64,9 @@ discard block |
||
64 | 64 | |
65 | 65 | $this->middleware->add('foo'); |
66 | 66 | $this->assertEquals(3, count($this->middleware->all())); |
67 | - $this->middleware->add(function () { |
|
67 | + $this->middleware->add(function() { |
|
68 | 68 | }); |
69 | - $this->middleware->add(function () { |
|
69 | + $this->middleware->add(function() { |
|
70 | 70 | }); |
71 | 71 | $this->assertEquals(5, count($this->middleware->all())); |
72 | 72 | } |
@@ -85,10 +85,10 @@ discard block |
||
85 | 85 | $handle->shouldReceive('report')->with($e)->andReturnNull(); |
86 | 86 | $handle->shouldReceive('render')->with($request, $e)->andReturn($response); |
87 | 87 | |
88 | - $foo->shouldReceive('handle')->once()->andReturnUsing(function ($request, $next) { |
|
88 | + $foo->shouldReceive('handle')->once()->andReturnUsing(function($request, $next) { |
|
89 | 89 | return $next($request); |
90 | 90 | }); |
91 | - $bar->shouldReceive('handle')->once()->andReturnUsing(function ($request, $next) use ($e) { |
|
91 | + $bar->shouldReceive('handle')->once()->andReturnUsing(function($request, $next) use ($e) { |
|
92 | 92 | $next($request); |
93 | 93 | throw $e; |
94 | 94 | }); |
@@ -99,13 +99,13 @@ discard block |
||
99 | 99 | |
100 | 100 | $this->config->shouldReceive('get')->once()->with('middleware.priority', [])->andReturn(['FooMiddleware', 'BarMiddleware']); |
101 | 101 | |
102 | - $this->middleware->import([function ($request, $next) { |
|
102 | + $this->middleware->import([function($request, $next) { |
|
103 | 103 | return $next($request); |
104 | 104 | }, 'BarMiddleware', 'FooMiddleware']); |
105 | 105 | |
106 | 106 | $this->assertInstanceOf(Pipeline::class, $pipeline = $this->middleware->pipeline()); |
107 | 107 | |
108 | - $pipeline->send($request)->then(function ($request) use ($e, $response) { |
|
108 | + $pipeline->send($request)->then(function($request) use ($e, $response) { |
|
109 | 109 | throw $e; |
110 | 110 | }); |
111 | 111 |
@@ -8,7 +8,7 @@ discard block |
||
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\exception; |
14 | 14 | |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | } |
74 | 74 | |
75 | 75 | if ($this->app->config->get('log.record_trace')) { |
76 | - $log .= PHP_EOL . $exception->getTraceAsString(); |
|
76 | + $log .= PHP_EOL.$exception->getTraceAsString(); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | $this->app->log->record($log, 'error'); |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | ob_start(); |
214 | 214 | $data = $this->convertExceptionToArray($exception); |
215 | 215 | extract($data); |
216 | - include $this->app->config->get('app.exception_tmpl') ?: __DIR__ . '/../../tpl/think_exception.tpl'; |
|
216 | + include $this->app->config->get('app.exception_tmpl') ?: __DIR__.'/../../tpl/think_exception.tpl'; |
|
217 | 217 | |
218 | 218 | return ob_get_clean(); |
219 | 219 | } |
@@ -255,10 +255,10 @@ discard block |
||
255 | 255 | |
256 | 256 | if (strpos($message, ':')) { |
257 | 257 | $name = strstr($message, ':', true); |
258 | - $message = $lang->has($name) ? $lang->get($name) . strstr($message, ':') : $message; |
|
258 | + $message = $lang->has($name) ? $lang->get($name).strstr($message, ':') : $message; |
|
259 | 259 | } elseif (strpos($message, ',')) { |
260 | 260 | $name = strstr($message, ',', true); |
261 | - $message = $lang->has($name) ? $lang->get($name) . ':' . substr(strstr($message, ','), 1) : $message; |
|
261 | + $message = $lang->has($name) ? $lang->get($name).':'.substr(strstr($message, ','), 1) : $message; |
|
262 | 262 | } elseif ($lang->has($message)) { |
263 | 263 | $message = $lang->get($message); |
264 | 264 | } |
@@ -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\session\driver; |
14 | 14 | |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | $this->config = array_merge($this->config, $config); |
40 | 40 | |
41 | 41 | if (empty($this->config['path'])) { |
42 | - $this->config['path'] = $app->getRootPath() . 'runtime' . DIRECTORY_SEPARATOR . 'session' . DIRECTORY_SEPARATOR; |
|
42 | + $this->config['path'] = $app->getRootPath().'runtime'.DIRECTORY_SEPARATOR.'session'.DIRECTORY_SEPARATOR; |
|
43 | 43 | } elseif (substr($this->config['path'], -1) != DIRECTORY_SEPARATOR) { |
44 | 44 | $this->config['path'] .= DIRECTORY_SEPARATOR; |
45 | 45 | } |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | $lifetime = $this->config['expire']; |
77 | 77 | $now = time(); |
78 | 78 | |
79 | - $files = $this->findFiles($this->config['path'], function (SplFileInfo $item) use ($lifetime, $now) { |
|
79 | + $files = $this->findFiles($this->config['path'], function(SplFileInfo $item) use ($lifetime, $now) { |
|
80 | 80 | return $now - $lifetime > $item->getMTime(); |
81 | 81 | }); |
82 | 82 | |
@@ -118,12 +118,12 @@ discard block |
||
118 | 118 | { |
119 | 119 | if ($this->config['prefix']) { |
120 | 120 | // 使用子目录 |
121 | - $name = $this->config['prefix'] . DIRECTORY_SEPARATOR . 'sess_' . $name; |
|
121 | + $name = $this->config['prefix'].DIRECTORY_SEPARATOR.'sess_'.$name; |
|
122 | 122 | } else { |
123 | - $name = 'sess_' . $name; |
|
123 | + $name = 'sess_'.$name; |
|
124 | 124 | } |
125 | 125 | |
126 | - $filename = $this->config['path'] . $name; |
|
126 | + $filename = $this->config['path'].$name; |
|
127 | 127 | $dir = dirname($filename); |
128 | 128 | |
129 | 129 | if ($auto && !is_dir($dir)) { |
@@ -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 | |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | |
54 | 54 | if (strpos($controller, '.')) { |
55 | 55 | $pos = strrpos($controller, '.'); |
56 | - $this->controller = substr($controller, 0, $pos) . '.' . Str::studly(substr($controller, $pos + 1)); |
|
56 | + $this->controller = substr($controller, 0, $pos).'.'.Str::studly(substr($controller, $pos + 1)); |
|
57 | 57 | } else { |
58 | 58 | $this->controller = Str::studly($controller); |
59 | 59 | } |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | // 实例化控制器 |
74 | 74 | $instance = $this->controller($this->controller); |
75 | 75 | } catch (ClassNotFoundException $e) { |
76 | - throw new HttpException(404, 'controller not exists:' . $e->getClass()); |
|
76 | + throw new HttpException(404, 'controller not exists:'.$e->getClass()); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | // 注册控制器中间件 |
@@ -81,9 +81,9 @@ discard block |
||
81 | 81 | |
82 | 82 | return $this->app->middleware->pipeline('controller') |
83 | 83 | ->send($this->request) |
84 | - ->then(function () use ($instance) { |
|
84 | + ->then(function() use ($instance) { |
|
85 | 85 | // 获取当前操作名 |
86 | - $action = $this->actionName . $this->rule->config('action_suffix'); |
|
86 | + $action = $this->actionName.$this->rule->config('action_suffix'); |
|
87 | 87 | |
88 | 88 | if (is_callable([$instance, $action])) { |
89 | 89 | $vars = $this->request->param(); |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | } |
100 | 100 | } else { |
101 | 101 | // 操作不存在 |
102 | - throw new HttpException(404, 'method not exists:' . get_class($instance) . '->' . $action . '()'); |
|
102 | + throw new HttpException(404, 'method not exists:'.get_class($instance).'->'.$action.'()'); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | $data = $this->app->invokeReflectMethod($instance, $reflect, $vars); |
@@ -126,11 +126,11 @@ discard block |
||
126 | 126 | |
127 | 127 | foreach ($middlewares as $key => $val) { |
128 | 128 | if (!is_int($key)) { |
129 | - if (isset($val['only']) && !in_array($this->request->action(true), array_map(function ($item) { |
|
129 | + if (isset($val['only']) && !in_array($this->request->action(true), array_map(function($item) { |
|
130 | 130 | return strtolower($item); |
131 | 131 | }, is_string($val['only']) ? explode(",", $val['only']) : $val['only']))) { |
132 | 132 | continue; |
133 | - } elseif (isset($val['except']) && in_array($this->request->action(true), array_map(function ($item) { |
|
133 | + } elseif (isset($val['except']) && in_array($this->request->action(true), array_map(function($item) { |
|
134 | 134 | return strtolower($item); |
135 | 135 | }, is_string($val['except']) ? explode(',', $val['except']) : $val['except']))) { |
136 | 136 | continue; |
@@ -162,14 +162,14 @@ discard block |
||
162 | 162 | $controllerLayer = $this->rule->config('controller_layer') ?: 'controller'; |
163 | 163 | $emptyController = $this->rule->config('empty_controller') ?: 'Error'; |
164 | 164 | |
165 | - $class = $this->app->parseClass($controllerLayer, $name . $suffix); |
|
165 | + $class = $this->app->parseClass($controllerLayer, $name.$suffix); |
|
166 | 166 | |
167 | 167 | if (class_exists($class)) { |
168 | 168 | return $this->app->make($class, [], true); |
169 | - } elseif ($emptyController && class_exists($emptyClass = $this->app->parseClass($controllerLayer, $emptyController . $suffix))) { |
|
169 | + } elseif ($emptyController && class_exists($emptyClass = $this->app->parseClass($controllerLayer, $emptyController.$suffix))) { |
|
170 | 170 | return $this->app->make($emptyClass, [], true); |
171 | 171 | } |
172 | 172 | |
173 | - throw new ClassNotFoundException('class not exists:' . $class, $class); |
|
173 | + throw new ClassNotFoundException('class not exists:'.$class, $class); |
|
174 | 174 | } |
175 | 175 | } |
@@ -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 | |
@@ -160,9 +160,9 @@ discard block |
||
160 | 160 | $this->ruleName = new RuleName(); |
161 | 161 | $this->setDefaultDomain(); |
162 | 162 | |
163 | - if (is_file($this->app->getRuntimePath() . 'route.php')) { |
|
163 | + if (is_file($this->app->getRuntimePath().'route.php')) { |
|
164 | 164 | // 读取路由映射文件 |
165 | - $this->import(include $this->app->getRuntimePath() . 'route.php'); |
|
165 | + $this->import(include $this->app->getRuntimePath().'route.php'); |
|
166 | 166 | } |
167 | 167 | } |
168 | 168 | |
@@ -392,14 +392,14 @@ discard block |
||
392 | 392 | if (is_null($domain)) { |
393 | 393 | $domain = $this->host; |
394 | 394 | } elseif (false === strpos($domain, '.') && $this->request) { |
395 | - $domain .= '.' . $this->request->rootDomain(); |
|
395 | + $domain .= '.'.$this->request->rootDomain(); |
|
396 | 396 | } |
397 | 397 | |
398 | 398 | if ($this->request) { |
399 | 399 | $subDomain = $this->request->subDomain(); |
400 | 400 | |
401 | 401 | if (strpos($subDomain, '.')) { |
402 | - $name = '*' . strstr($subDomain, '.'); |
|
402 | + $name = '*'.strstr($subDomain, '.'); |
|
403 | 403 | } |
404 | 404 | } |
405 | 405 | |
@@ -743,7 +743,7 @@ discard block |
||
743 | 743 | |
744 | 744 | return $this->app->middleware->pipeline('route') |
745 | 745 | ->send($request) |
746 | - ->then(function () use ($dispatch) { |
|
746 | + ->then(function() use ($dispatch) { |
|
747 | 747 | return $dispatch->run(); |
748 | 748 | }); |
749 | 749 | } |
@@ -792,10 +792,10 @@ discard block |
||
792 | 792 | $path = $pathinfo; |
793 | 793 | } elseif ($suffix) { |
794 | 794 | // 去除正常的URL后缀 |
795 | - $path = preg_replace('/\.(' . ltrim($suffix, '.') . ')$/i', '', $pathinfo); |
|
795 | + $path = preg_replace('/\.('.ltrim($suffix, '.').')$/i', '', $pathinfo); |
|
796 | 796 | } else { |
797 | 797 | // 允许任何后缀访问 |
798 | - $path = preg_replace('/\.' . $this->request->ext() . '$/i', '', $pathinfo); |
|
798 | + $path = preg_replace('/\.'.$this->request->ext().'$/i', '', $pathinfo); |
|
799 | 799 | } |
800 | 800 | |
801 | 801 | return $path; |
@@ -838,9 +838,9 @@ discard block |
||
838 | 838 | $item = $this->domains[$this->host]; |
839 | 839 | } elseif (isset($this->domains[$subDomain])) { |
840 | 840 | $item = $this->domains[$subDomain]; |
841 | - } elseif (isset($this->domains['*.' . $domain2]) && !empty($domain3)) { |
|
841 | + } elseif (isset($this->domains['*.'.$domain2]) && !empty($domain3)) { |
|
842 | 842 | // 泛三级域名 |
843 | - $item = $this->domains['*.' . $domain2]; |
|
843 | + $item = $this->domains['*.'.$domain2]; |
|
844 | 844 | $panDomain = $domain3; |
845 | 845 | } elseif (isset($this->domains['*']) && !empty($domain2)) { |
846 | 846 | // 泛二级域名 |