@@ -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 | |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | return $this->make($abstract); |
132 | 132 | } |
133 | 133 | |
134 | - throw new ClassNotFoundException('class not exists: ' . $abstract, $abstract); |
|
134 | + throw new ClassNotFoundException('class not exists: '.$abstract, $abstract); |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | /** |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | } else { |
302 | 302 | $function .= '()'; |
303 | 303 | } |
304 | - throw new Exception('function not exists: ' . $function, 0, $e); |
|
304 | + throw new Exception('function not exists: '.$function, 0, $e); |
|
305 | 305 | } |
306 | 306 | } |
307 | 307 | |
@@ -334,12 +334,12 @@ discard block |
||
334 | 334 | } catch (ReflectionException $e) { |
335 | 335 | if (is_array($method)) { |
336 | 336 | $class = is_object($method[0]) ? get_class($method[0]) : $method[0]; |
337 | - $callback = $class . '::' . $method[1]; |
|
337 | + $callback = $class.'::'.$method[1]; |
|
338 | 338 | } else { |
339 | 339 | $callback = $method; |
340 | 340 | } |
341 | 341 | |
342 | - throw new Exception('method not exists: ' . $callback . '()', 0, $e); |
|
342 | + throw new Exception('method not exists: '.$callback.'()', 0, $e); |
|
343 | 343 | } |
344 | 344 | } |
345 | 345 | |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | |
407 | 407 | return $object; |
408 | 408 | } catch (ReflectionException $e) { |
409 | - throw new ClassNotFoundException('class not exists: ' . $class, $class, $e); |
|
409 | + throw new ClassNotFoundException('class not exists: '.$class, $class, $e); |
|
410 | 410 | } |
411 | 411 | } |
412 | 412 | |
@@ -467,7 +467,7 @@ discard block |
||
467 | 467 | } elseif ($param->isDefaultValueAvailable()) { |
468 | 468 | $args[] = $param->getDefaultValue(); |
469 | 469 | } else { |
470 | - throw new InvalidArgumentException('method param miss:' . $name); |
|
470 | + throw new InvalidArgumentException('method param miss:'.$name); |
|
471 | 471 | } |
472 | 472 | } |
473 | 473 | |
@@ -485,13 +485,13 @@ discard block |
||
485 | 485 | */ |
486 | 486 | public static function factory(string $name, string $namespace = '', ...$args) |
487 | 487 | { |
488 | - $class = false !== strpos($name, '\\') ? $name : $namespace . ucwords($name); |
|
488 | + $class = false !== strpos($name, '\\') ? $name : $namespace.ucwords($name); |
|
489 | 489 | |
490 | 490 | if (class_exists($class)) { |
491 | 491 | return Container::getInstance()->invokeClass($class, $args); |
492 | 492 | } |
493 | 493 | |
494 | - throw new ClassNotFoundException('class not exists:' . $class, $class); |
|
494 | + throw new ClassNotFoundException('class not exists:'.$class, $class); |
|
495 | 495 | } |
496 | 496 | |
497 | 497 | /** |
@@ -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 | |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | if ($bind && preg_match('/^[a-z]/is', $bind)) { |
48 | 48 | $bind = str_replace('/', $depr, $bind); |
49 | 49 | // 如果有模块/控制器绑定 |
50 | - $url = $bind . ('.' != substr($bind, -1) ? $depr : '') . ltrim($url, $depr); |
|
50 | + $url = $bind.('.' != substr($bind, -1) ? $depr : '').ltrim($url, $depr); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | $path = $this->rule->parseUrlPath($url); |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | $controller = !empty($path) ? array_shift($path) : null; |
60 | 60 | |
61 | 61 | if ($controller && !preg_match('/^[A-Za-z][\w|\.]*$/', $controller)) { |
62 | - throw new HttpException(404, 'controller not exists:' . $controller); |
|
62 | + throw new HttpException(404, 'controller not exists:'.$controller); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | // 解析操作 |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | |
69 | 69 | // 解析额外参数 |
70 | 70 | if ($path) { |
71 | - preg_replace_callback('/(\w+)\|([^\|]+)/', function ($match) use (&$var) { |
|
71 | + preg_replace_callback('/(\w+)\|([^\|]+)/', function($match) use (&$var) { |
|
72 | 72 | $var[$match[1]] = strip_tags($match[2]); |
73 | 73 | }, implode('|', $path)); |
74 | 74 | } |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | $route = [$controller, $action]; |
87 | 87 | |
88 | 88 | if ($this->hasDefinedRoute($route)) { |
89 | - throw new HttpException(404, 'invalid request:' . str_replace('|', $depr, $url)); |
|
89 | + throw new HttpException(404, 'invalid request:'.str_replace('|', $depr, $url)); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | return $route; |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | list($controller, $action) = $route; |
104 | 104 | |
105 | 105 | // 检查地址是否被定义过路由 |
106 | - $name = strtolower(Str::studly($controller) . '/' . $action); |
|
106 | + $name = strtolower(Str::studly($controller).'/'.$action); |
|
107 | 107 | |
108 | 108 | $host = $this->request->host(true); |
109 | 109 | $method = $this->request->method(); |