@@ -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,7 +78,7 @@ 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; |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | $this->content = $content; |
101 | 101 | |
102 | 102 | extract($data, EXTR_OVERWRITE); |
103 | - eval('?>' . $this->content); |
|
103 | + eval('?>'.$this->content); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | /** |
@@ -125,10 +125,10 @@ discard block |
||
125 | 125 | $appName = isset($app) ? $app : $this->app->http->getName(); |
126 | 126 | $view = $this->config['view_dir_name']; |
127 | 127 | |
128 | - if (is_dir($this->app->getAppPath() . $view)) { |
|
129 | - $path = isset($app) ? $this->app->getBasePath() . ($appName ? $appName . DIRECTORY_SEPARATOR : '') . $view . DIRECTORY_SEPARATOR : $this->app->getAppPath() . $view . DIRECTORY_SEPARATOR; |
|
128 | + if (is_dir($this->app->getAppPath().$view)) { |
|
129 | + $path = isset($app) ? $this->app->getBasePath().($appName ? $appName.DIRECTORY_SEPARATOR : '').$view.DIRECTORY_SEPARATOR : $this->app->getAppPath().$view.DIRECTORY_SEPARATOR; |
|
130 | 130 | } else { |
131 | - $path = $this->app->getRootPath() . $view . DIRECTORY_SEPARATOR . ($appName ? $appName . DIRECTORY_SEPARATOR : ''); |
|
131 | + $path = $this->app->getRootPath().$view.DIRECTORY_SEPARATOR.($appName ? $appName.DIRECTORY_SEPARATOR : ''); |
|
132 | 132 | } |
133 | 133 | } |
134 | 134 | |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | $controller = $request->controller(); |
140 | 140 | if (strpos($controller, '.')) { |
141 | 141 | $pos = strrpos($controller, '.'); |
142 | - $controller = substr($controller, 0, $pos) . '.' . Str::snake(substr($controller, $pos + 1)); |
|
142 | + $controller = substr($controller, 0, $pos).'.'.Str::snake(substr($controller, $pos + 1)); |
|
143 | 143 | } else { |
144 | 144 | $controller = Str::snake($controller); |
145 | 145 | } |
@@ -155,16 +155,16 @@ discard block |
||
155 | 155 | $template = Str::snake($request->action()); |
156 | 156 | } |
157 | 157 | |
158 | - $template = str_replace('.', DIRECTORY_SEPARATOR, $controller) . $depr . $template; |
|
158 | + $template = str_replace('.', DIRECTORY_SEPARATOR, $controller).$depr.$template; |
|
159 | 159 | } elseif (false === strpos($template, $depr)) { |
160 | - $template = str_replace('.', DIRECTORY_SEPARATOR, $controller) . $depr . $template; |
|
160 | + $template = str_replace('.', DIRECTORY_SEPARATOR, $controller).$depr.$template; |
|
161 | 161 | } |
162 | 162 | } |
163 | 163 | } else { |
164 | 164 | $template = str_replace(['/', ':'], $depr, substr($template, 1)); |
165 | 165 | } |
166 | 166 | |
167 | - return $path . ltrim($template, '/') . '.' . ltrim($this->config['view_suffix'], '.'); |
|
167 | + return $path.ltrim($template, '/').'.'.ltrim($this->config['view_suffix'], '.'); |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | /** |
@@ -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; |
14 | 14 | |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | } |
191 | 191 | } |
192 | 192 | } elseif (false === strpos($domain, '.') && 0 !== strpos($domain, $rootDomain)) { |
193 | - $domain .= '.' . $rootDomain; |
|
193 | + $domain .= '.'.$rootDomain; |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | if (false !== strpos($domain, '://')) { |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | $scheme = $this->https || $request->isSsl() ? 'https://' : 'http://'; |
200 | 200 | } |
201 | 201 | |
202 | - return $scheme . $domain; |
|
202 | + return $scheme.$domain; |
|
203 | 203 | } |
204 | 204 | |
205 | 205 | /** |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | } |
219 | 219 | } |
220 | 220 | |
221 | - return (empty($suffix) || 0 === strpos($suffix, '.')) ? (string) $suffix : '.' . $suffix; |
|
221 | + return (empty($suffix) || 0 === strpos($suffix, '.')) ? (string) $suffix : '.'.$suffix; |
|
222 | 222 | } |
223 | 223 | |
224 | 224 | /** |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | // 解析到控制器 |
243 | 243 | $url = substr($url, 1); |
244 | 244 | } elseif ('' === $url) { |
245 | - $url = $request->controller() . '/' . $request->action(); |
|
245 | + $url = $request->controller().'/'.$request->action(); |
|
246 | 246 | } else { |
247 | 247 | $controller = $request->controller(); |
248 | 248 | |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | $action = array_pop($path); |
251 | 251 | $controller = empty($path) ? $controller : array_pop($path); |
252 | 252 | |
253 | - $url = $controller . '/' . $action; |
|
253 | + $url = $controller.'/'.$action; |
|
254 | 254 | } |
255 | 255 | |
256 | 256 | return $url; |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | { |
298 | 298 | $request = $this->app->request; |
299 | 299 | if (is_string($allowDomain) && false === strpos($allowDomain, '.')) { |
300 | - $allowDomain .= '.' . $request->rootDomain(); |
|
300 | + $allowDomain .= '.'.$request->rootDomain(); |
|
301 | 301 | } |
302 | 302 | $port = $request->port(); |
303 | 303 | |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | } |
317 | 317 | |
318 | 318 | if ($port && !in_array($port, [80, 443])) { |
319 | - $domain .= ':' . $port; |
|
319 | + $domain .= ':'.$port; |
|
320 | 320 | } |
321 | 321 | |
322 | 322 | if (empty($pattern)) { |
@@ -328,12 +328,12 @@ discard block |
||
328 | 328 | |
329 | 329 | foreach ($pattern as $key => $val) { |
330 | 330 | if (isset($vars[$key])) { |
331 | - $url = str_replace(['[:' . $key . ']', '<' . $key . '?>', ':' . $key, '<' . $key . '>'], $type ? $vars[$key] : urlencode((string) $vars[$key]), $url); |
|
331 | + $url = str_replace(['[:'.$key.']', '<'.$key.'?>', ':'.$key, '<'.$key.'>'], $type ? $vars[$key] : urlencode((string) $vars[$key]), $url); |
|
332 | 332 | $keys[] = $key; |
333 | 333 | $url = str_replace(['/?', '-?'], ['/', '-'], $url); |
334 | 334 | $result = [rtrim($url, '?/-'), $domain, $suffix]; |
335 | 335 | } elseif (2 == $val) { |
336 | - $url = str_replace(['/[:' . $key . ']', '[:' . $key . ']', '<' . $key . '?>'], '', $url); |
|
336 | + $url = str_replace(['/[:'.$key.']', '[:'.$key.']', '<'.$key.'?>'], '', $url); |
|
337 | 337 | $url = str_replace(['/?', '-?'], ['/', '-'], $url); |
338 | 338 | $result = [rtrim($url, '?/-'), $domain, $suffix]; |
339 | 339 | } else { |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | if (0 === strpos($url, '[') && $pos = strpos($url, ']')) { |
366 | 366 | // [name] 表示使用路由命名标识生成URL |
367 | 367 | $name = substr($url, 1, $pos - 1); |
368 | - $url = 'name' . substr($url, $pos + 1); |
|
368 | + $url = 'name'.substr($url, $pos + 1); |
|
369 | 369 | } |
370 | 370 | |
371 | 371 | if (false === strpos($url, '://') && 0 !== strpos($url, '/')) { |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | } |
393 | 393 | |
394 | 394 | if ($url) { |
395 | - $checkName = isset($name) ? $name : $url . (isset($info['query']) ? '?' . $info['query'] : ''); |
|
395 | + $checkName = isset($name) ? $name : $url.(isset($info['query']) ? '?'.$info['query'] : ''); |
|
396 | 396 | $checkDomain = $domain && is_string($domain) ? $domain : null; |
397 | 397 | |
398 | 398 | $rule = $this->route->getName($checkName, $checkDomain); |
@@ -418,7 +418,7 @@ discard block |
||
418 | 418 | $suffix = $match[2]; |
419 | 419 | } |
420 | 420 | } elseif (!empty($rule) && isset($name)) { |
421 | - throw new \InvalidArgumentException('route name not exists:' . $name); |
|
421 | + throw new \InvalidArgumentException('route name not exists:'.$name); |
|
422 | 422 | } else { |
423 | 423 | // 检测URL绑定 |
424 | 424 | $bind = $this->route->getDomainBind($domain && is_string($domain) ? $domain : null); |
@@ -456,7 +456,7 @@ discard block |
||
456 | 456 | $file = str_replace('\\', '/', dirname($file)); |
457 | 457 | } |
458 | 458 | |
459 | - $url = rtrim($file, '/') . '/' . $url; |
|
459 | + $url = rtrim($file, '/').'/'.$url; |
|
460 | 460 | |
461 | 461 | // URL后缀 |
462 | 462 | if ('/' == substr($url, -1) || '' == $url) { |
@@ -466,33 +466,33 @@ discard block |
||
466 | 466 | } |
467 | 467 | |
468 | 468 | // 锚点 |
469 | - $anchor = !empty($anchor) ? '#' . $anchor : ''; |
|
469 | + $anchor = !empty($anchor) ? '#'.$anchor : ''; |
|
470 | 470 | |
471 | 471 | // 参数组装 |
472 | 472 | if (!empty($vars)) { |
473 | 473 | // 添加参数 |
474 | 474 | if ($this->route->config('url_common_param')) { |
475 | 475 | $vars = http_build_query($vars); |
476 | - $url .= $suffix . '?' . $vars . $anchor; |
|
476 | + $url .= $suffix.'?'.$vars.$anchor; |
|
477 | 477 | } else { |
478 | 478 | foreach ($vars as $var => $val) { |
479 | 479 | $val = (string) $val; |
480 | 480 | if ('' !== $val) { |
481 | - $url .= $depr . $var . $depr . urlencode($val); |
|
481 | + $url .= $depr.$var.$depr.urlencode($val); |
|
482 | 482 | } |
483 | 483 | } |
484 | 484 | |
485 | - $url .= $suffix . $anchor; |
|
485 | + $url .= $suffix.$anchor; |
|
486 | 486 | } |
487 | 487 | } else { |
488 | - $url .= $suffix . $anchor; |
|
488 | + $url .= $suffix.$anchor; |
|
489 | 489 | } |
490 | 490 | |
491 | 491 | // 检测域名 |
492 | 492 | $domain = $this->parseDomain($url, $domain); |
493 | 493 | |
494 | 494 | // URL组装 |
495 | - return $domain . rtrim($this->root, '/') . '/' . ltrim($url, '/'); |
|
495 | + return $domain.rtrim($this->root, '/').'/'.ltrim($url, '/'); |
|
496 | 496 | } |
497 | 497 | |
498 | 498 | public function __toString() |
@@ -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 | |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | { |
98 | 98 | $target = $this->getTargetFile($directory, $name); |
99 | 99 | |
100 | - set_error_handler(function ($type, $msg) use (&$error) { |
|
100 | + set_error_handler(function($type, $msg) use (&$error) { |
|
101 | 101 | $error = $msg; |
102 | 102 | }); |
103 | 103 | $renamed = rename($this->getPathname(), (string) $target); |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | throw new FileException(sprintf('Unable to write in the "%s" directory', $directory)); |
128 | 128 | } |
129 | 129 | |
130 | - $target = rtrim($directory, '/\\') . \DIRECTORY_SEPARATOR . (null === $name ? $this->getBasename() : $this->getName($name)); |
|
130 | + $target = rtrim($directory, '/\\').\DIRECTORY_SEPARATOR.(null === $name ? $this->getBasename() : $this->getName($name)); |
|
131 | 131 | |
132 | 132 | return new self($target, false); |
133 | 133 | } |
@@ -170,18 +170,18 @@ discard block |
||
170 | 170 | switch (true) { |
171 | 171 | case in_array($rule, hash_algos()): |
172 | 172 | $hash = $this->hash($rule); |
173 | - $this->hashName = substr($hash, 0, 2) . DIRECTORY_SEPARATOR . substr($hash, 2); |
|
173 | + $this->hashName = substr($hash, 0, 2).DIRECTORY_SEPARATOR.substr($hash, 2); |
|
174 | 174 | break; |
175 | 175 | case is_callable($rule): |
176 | 176 | $this->hashName = call_user_func($rule); |
177 | 177 | break; |
178 | 178 | default: |
179 | - $this->hashName = date('Ymd') . DIRECTORY_SEPARATOR . md5((string) microtime(true)); |
|
179 | + $this->hashName = date('Ymd').DIRECTORY_SEPARATOR.md5((string) microtime(true)); |
|
180 | 180 | break; |
181 | 181 | } |
182 | 182 | } |
183 | 183 | } |
184 | 184 | |
185 | - return $this->hashName . '.' . $this->extension(); |
|
185 | + return $this->hashName.'.'.$this->extension(); |
|
186 | 186 | } |
187 | 187 | } |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | // +---------------------------------------------------------------------- |
9 | 9 | // | Author: luofei614 <weibo.com/luofei614> |
10 | 10 | // +---------------------------------------------------------------------- |
11 | -declare (strict_types = 1); |
|
11 | +declare(strict_types=1); |
|
12 | 12 | |
13 | 13 | namespace think\log\driver; |
14 | 14 | |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | if ($this->app->exists('request')) { |
93 | 93 | $current_uri = $this->app->request->url(true); |
94 | 94 | } else { |
95 | - $current_uri = 'cmd:' . implode(' ', $_SERVER['argv'] ?? []); |
|
95 | + $current_uri = 'cmd:'.implode(' ', $_SERVER['argv'] ?? []); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | if (!empty($this->config['format_head'])) { |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | foreach ($log as $type => $val) { |
117 | 117 | $trace[] = [ |
118 | 118 | 'type' => isset($expand_level[$type]) ? 'group' : 'groupCollapsed', |
119 | - 'msg' => '[ ' . $type . ' ]', |
|
119 | + 'msg' => '[ '.$type.' ]', |
|
120 | 120 | 'css' => $this->css[$type] ?? '', |
121 | 121 | ]; |
122 | 122 | |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | ]; |
203 | 203 | |
204 | 204 | $msg = json_encode($logs, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_PARTIAL_OUTPUT_ON_ERROR); |
205 | - $address = '/' . $client_id; //将client_id作为地址, server端通过地址判断将日志发布给谁 |
|
205 | + $address = '/'.$client_id; //将client_id作为地址, server端通过地址判断将日志发布给谁 |
|
206 | 206 | |
207 | 207 | $this->send($this->config['host'], $this->config['port'], $msg, $address); |
208 | 208 | } |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | */ |
286 | 286 | protected function send($host, $port, $message = '', $address = '/') |
287 | 287 | { |
288 | - $url = 'http://' . $host . ':' . $port . $address; |
|
288 | + $url = 'http://'.$host.':'.$port.$address; |
|
289 | 289 | $ch = curl_init(); |
290 | 290 | |
291 | 291 | curl_setopt($ch, CURLOPT_URL, $url); |
@@ -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() . ($dir ? 'app' . DIRECTORY_SEPARATOR . $dir . DIRECTORY_SEPARATOR : '') . 'route' . DIRECTORY_SEPARATOR ; |
|
49 | + $path = $this->app->getRootPath().($dir ? 'app'.DIRECTORY_SEPARATOR.$dir.DIRECTORY_SEPARATOR : '').'route'.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 |
@@ -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 | |
@@ -72,12 +72,12 @@ discard block |
||
72 | 72 | } |
73 | 73 | |
74 | 74 | if ($this->app->config->get('log.record_trace')) { |
75 | - $log .= PHP_EOL . $exception->getTraceAsString(); |
|
75 | + $log .= PHP_EOL.$exception->getTraceAsString(); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | try { |
79 | 79 | $this->app->log->record($log, 'error'); |
80 | - } catch (Exception $e){} |
|
80 | + } catch (Exception $e) {} |
|
81 | 81 | } |
82 | 82 | } |
83 | 83 | |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | ob_start(); |
224 | 224 | $data = $this->convertExceptionToArray($exception); |
225 | 225 | extract($data); |
226 | - include $this->app->config->get('app.exception_tmpl') ?: __DIR__ . '/../../tpl/think_exception.tpl'; |
|
226 | + include $this->app->config->get('app.exception_tmpl') ?: __DIR__.'/../../tpl/think_exception.tpl'; |
|
227 | 227 | |
228 | 228 | return ob_get_clean(); |
229 | 229 | } |
@@ -265,10 +265,10 @@ discard block |
||
265 | 265 | |
266 | 266 | if (strpos($message, ':')) { |
267 | 267 | $name = strstr($message, ':', true); |
268 | - $message = $lang->has($name) ? $lang->get($name) . strstr($message, ':') : $message; |
|
268 | + $message = $lang->has($name) ? $lang->get($name).strstr($message, ':') : $message; |
|
269 | 269 | } elseif (strpos($message, ',')) { |
270 | 270 | $name = strstr($message, ',', true); |
271 | - $message = $lang->has($name) ? $lang->get($name) . ':' . substr(strstr($message, ','), 1) : $message; |
|
271 | + $message = $lang->has($name) ? $lang->get($name).':'.substr(strstr($message, ','), 1) : $message; |
|
272 | 272 | } elseif ($lang->has($message)) { |
273 | 273 | $message = $lang->get($message); |
274 | 274 | } |
@@ -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,10 +81,10 @@ 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 | 86 | $suffix = $this->rule->config('action_suffix'); |
87 | - $action = $this->actionName . $suffix; |
|
87 | + $action = $this->actionName.$suffix; |
|
88 | 88 | |
89 | 89 | if (is_callable([$instance, $action])) { |
90 | 90 | $vars = $this->request->param(); |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | } |
105 | 105 | } else { |
106 | 106 | // 操作不存在 |
107 | - throw new HttpException(404, 'method not exists:' . get_class($instance) . '->' . $action . '()'); |
|
107 | + throw new HttpException(404, 'method not exists:'.get_class($instance).'->'.$action.'()'); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | $data = $this->app->invokeReflectMethod($instance, $reflect, $vars); |
@@ -131,11 +131,11 @@ discard block |
||
131 | 131 | |
132 | 132 | foreach ($middlewares as $key => $val) { |
133 | 133 | if (!is_int($key)) { |
134 | - if (isset($val['only']) && !in_array($this->request->action(true), array_map(function ($item) { |
|
134 | + if (isset($val['only']) && !in_array($this->request->action(true), array_map(function($item) { |
|
135 | 135 | return strtolower($item); |
136 | 136 | }, is_string($val['only']) ? explode(",", $val['only']) : $val['only']))) { |
137 | 137 | continue; |
138 | - } elseif (isset($val['except']) && in_array($this->request->action(true), array_map(function ($item) { |
|
138 | + } elseif (isset($val['except']) && in_array($this->request->action(true), array_map(function($item) { |
|
139 | 139 | return strtolower($item); |
140 | 140 | }, is_string($val['except']) ? explode(',', $val['except']) : $val['except']))) { |
141 | 141 | continue; |
@@ -167,14 +167,14 @@ discard block |
||
167 | 167 | $controllerLayer = $this->rule->config('controller_layer') ?: 'controller'; |
168 | 168 | $emptyController = $this->rule->config('empty_controller') ?: 'Error'; |
169 | 169 | |
170 | - $class = $this->app->parseClass($controllerLayer, $name . $suffix); |
|
170 | + $class = $this->app->parseClass($controllerLayer, $name.$suffix); |
|
171 | 171 | |
172 | 172 | if (class_exists($class)) { |
173 | 173 | return $this->app->make($class, [], true); |
174 | - } elseif ($emptyController && class_exists($emptyClass = $this->app->parseClass($controllerLayer, $emptyController . $suffix))) { |
|
174 | + } elseif ($emptyController && class_exists($emptyClass = $this->app->parseClass($controllerLayer, $emptyController.$suffix))) { |
|
175 | 175 | return $this->app->make($emptyClass, [], true); |
176 | 176 | } |
177 | 177 | |
178 | - throw new ClassNotFoundException('class not exists:' . $class, $class); |
|
178 | + throw new ClassNotFoundException('class not exists:'.$class, $class); |
|
179 | 179 | } |
180 | 180 | } |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | // +---------------------------------------------------------------------- |
9 | 9 | // | Author: Slince <[email protected]> |
10 | 10 | // +---------------------------------------------------------------------- |
11 | -declare (strict_types = 1); |
|
11 | +declare(strict_types=1); |
|
12 | 12 | |
13 | 13 | namespace think; |
14 | 14 | |
@@ -133,8 +133,8 @@ discard block |
||
133 | 133 | public function pipeline(string $type = 'global') |
134 | 134 | { |
135 | 135 | return (new Pipeline()) |
136 | - ->through(array_map(function ($middleware) { |
|
137 | - return function ($request, $next) use ($middleware) { |
|
136 | + ->through(array_map(function($middleware) { |
|
137 | + return function($request, $next) use ($middleware) { |
|
138 | 138 | [$call, $params] = $middleware; |
139 | 139 | if (is_array($call) && is_string($call[0])) { |
140 | 140 | $call = [$this->app->make($call[0]), $call[1]]; |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | protected function sortMiddleware(array $middlewares) |
230 | 230 | { |
231 | 231 | $priority = $this->app->config->get('middleware.priority', []); |
232 | - uasort($middlewares, function ($a, $b) use ($priority) { |
|
232 | + uasort($middlewares, function($a, $b) use ($priority) { |
|
233 | 233 | $aPriority = $this->getMiddlewarePriority($priority, $a); |
234 | 234 | $bPriority = $this->getMiddlewarePriority($priority, $b); |
235 | 235 | return $bPriority - $aPriority; |
@@ -118,7 +118,7 @@ |
||
118 | 118 | */ |
119 | 119 | public function setId($id = null): void |
120 | 120 | { |
121 | - $this->id = is_string($id) && strlen($id) === 32 && ctype_alnum($id) ? $id : md5(microtime(true) . session_create_id()); |
|
121 | + $this->id = is_string($id) && strlen($id) === 32 && ctype_alnum($id) ? $id : md5(microtime(true).session_create_id()); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | /** |