@@ -65,9 +65,9 @@ |
||
65 | 65 | $desc = $info['description']; |
66 | 66 | $ms = number_format($time * 1000, 3); |
67 | 67 | if (strlen($desc)) { |
68 | - $timing[] = $name . ';desc="' . $desc . '";dur=' . $ms; |
|
68 | + $timing[] = $name.';desc="'.$desc.'";dur='.$ms; |
|
69 | 69 | } else { |
70 | - $timing[] = $name . ';dur=' . $ms; |
|
70 | + $timing[] = $name.';dur='.$ms; |
|
71 | 71 | } |
72 | 72 | } |
73 | 73 | $response->setHeader('server-timing', implode(',', $timing)); |
@@ -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; |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | $this->config = $config; |
79 | 79 | $this->name = $name ?? 'anonymous'; |
80 | 80 | $this->observer = new NullObserver; |
81 | - register_shutdown_function(function () { |
|
81 | + register_shutdown_function(function() { |
|
82 | 82 | $this->onBeforeSystemShutdown(); |
83 | 83 | }); |
84 | 84 | } |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | $this->pdo = $this->createPDO(); |
109 | 109 | $this->observer->connectDatabase(microtime(true) - $time); |
110 | 110 | $this->id = static::$connectionCount; |
111 | - static::$connectionCount ++; |
|
111 | + static::$connectionCount++; |
|
112 | 112 | } catch (PDOException $e) { |
113 | 113 | throw new SQLException(sprintf( |
114 | 114 | "%s connect database error:%s", |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | */ |
182 | 182 | public function beginTransaction() |
183 | 183 | { |
184 | - $this->transaction ++; |
|
184 | + $this->transaction++; |
|
185 | 185 | if ($this->transaction == 1) { |
186 | 186 | $this->pdo->beginTransaction(); |
187 | 187 | } |