@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * |
12 | 12 | * @var array |
13 | 13 | */ |
14 | - private $locales=[]; |
|
14 | + private $locales = []; |
|
15 | 15 | |
16 | 16 | /** |
17 | 17 | * 包含本地化语言数组 |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | */ |
51 | 51 | public static function format(string $text, array $param) |
52 | 52 | { |
53 | - return preg_replace_callback('/(?<!\$)\$(\{)?(\d+|\w+?\b)(?(1)\})/', function ($match) use ($param) { |
|
53 | + return preg_replace_callback('/(?<!\$)\$(\{)?(\d+|\w+?\b)(?(1)\})/', function($match) use ($param) { |
|
54 | 54 | $key = $match[2]; |
55 | 55 | if (array_key_exists($key, $param)) { |
56 | 56 | return strval($param[$key]); |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | protected function prepare(Request $request, Response $response) |
85 | 85 | { |
86 | 86 | |
87 | - $response->setHeader('x-powered-by', 'suda/' . SUDA_VERSION, true); |
|
87 | + $response->setHeader('x-powered-by', 'suda/'.SUDA_VERSION, true); |
|
88 | 88 | $response->getWrapper()->register(ExceptionContentWrapper::class, [Throwable::class]); |
89 | 89 | $response->getWrapper()->register(TemplateWrapper::class, [RawTemplate::class]); |
90 | 90 | |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | $init = $this->debug->timeEnd('init'); |
128 | 128 | $this->debug->recordTiming('init', $init, 'init total'); |
129 | 129 | $this->debug->time('match route'); |
130 | - $result = $this->route->match($appRequest->getMethod(), $appRequest->getUri()); |
|
130 | + $result = $this->route->match($appRequest->getMethod(), $appRequest->getUri()); |
|
131 | 131 | $match = $this->debug->timeEnd('match route'); |
132 | 132 | $this->debug->recordTiming('dispatch', $match); |
133 | 133 | if ($result !== null) { |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | if (!$appResponse->isSend()) { |
139 | 139 | $appResponse->end(); |
140 | 140 | } |
141 | - $this->debug->info('responded with code ' . $appResponse->getStatus()); |
|
141 | + $this->debug->info('responded with code '.$appResponse->getStatus()); |
|
142 | 142 | $this->debug->timeEnd('sending response'); |
143 | 143 | } catch (Throwable $e) { |
144 | 144 | $this->debug->uncaughtException($e); |
@@ -163,13 +163,13 @@ discard block |
||
163 | 163 | $route = $attributes['config'] ?? []; |
164 | 164 | $runnable = null; |
165 | 165 | if (array_key_exists('class', $route)) { |
166 | - $runnable = $this->className($route['class']) . '->onRequest'; |
|
166 | + $runnable = $this->className($route['class']).'->onRequest'; |
|
167 | 167 | } elseif (array_key_exists('source', $route)) { |
168 | 168 | $attributes['source'] = $route['source']; |
169 | - $runnable = FileRequestProcessor::class . '->onRequest'; |
|
169 | + $runnable = FileRequestProcessor::class.'->onRequest'; |
|
170 | 170 | } elseif (array_key_exists('template', $route)) { |
171 | 171 | $attributes['template'] = $route['template']; |
172 | - $runnable = TemplateRequestProcessor::class . '->onRequest'; |
|
172 | + $runnable = TemplateRequestProcessor::class.'->onRequest'; |
|
173 | 173 | } elseif (array_key_exists('runnable', $route)) { |
174 | 174 | $runnable = $route['runnable']; |
175 | 175 | } else { |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | |
44 | 44 | public function __construct(array $methods, string $uri, array $attribute = []) |
45 | 45 | { |
46 | - array_walk($methods, function ($value) { |
|
46 | + array_walk($methods, function($value) { |
|
47 | 47 | return strtoupper($value); |
48 | 48 | }); |
49 | 49 | $this->methods = $methods; |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | * @param string $uri |
161 | 161 | * @return array|null |
162 | 162 | */ |
163 | - public function match(string $method, string $uri):?array |
|
163 | + public function match(string $method, string $uri): ?array |
|
164 | 164 | { |
165 | 165 | if (count($this->methods) > 0 && !in_array($method, $this->methods)) { |
166 | 166 | return null; |