@@ -8,7 +8,7 @@ |
||
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\response; |
14 | 14 |
@@ -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\cache; |
14 | 14 | |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | */ |
85 | 85 | public function getCacheKey(string $name): string |
86 | 86 | { |
87 | - return $this->options['prefix'] . $name; |
|
87 | + return $this->options['prefix'].$name; |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | /** |
@@ -145,14 +145,14 @@ discard block |
||
145 | 145 | |
146 | 146 | $time = time(); |
147 | 147 | |
148 | - while ($time + 5 > time() && $this->has($name . '_lock')) { |
|
148 | + while ($time + 5 > time() && $this->has($name.'_lock')) { |
|
149 | 149 | // 存在锁定则等待 |
150 | 150 | usleep(200000); |
151 | 151 | } |
152 | 152 | |
153 | 153 | try { |
154 | 154 | // 锁定 |
155 | - $this->set($name . '_lock', true); |
|
155 | + $this->set($name.'_lock', true); |
|
156 | 156 | |
157 | 157 | if ($value instanceof Closure) { |
158 | 158 | // 获取缓存数据 |
@@ -163,9 +163,9 @@ discard block |
||
163 | 163 | $this->set($name, $value, $expire); |
164 | 164 | |
165 | 165 | // 解锁 |
166 | - $this->delete($name . '_lock'); |
|
166 | + $this->delete($name.'_lock'); |
|
167 | 167 | } catch (Exception | throwable $e) { |
168 | - $this->delete($name . '_lock'); |
|
168 | + $this->delete($name.'_lock'); |
|
169 | 169 | throw $e; |
170 | 170 | } |
171 | 171 | |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | $key = implode('-', $name); |
185 | 185 | |
186 | 186 | if (!isset($this->tag[$key])) { |
187 | - $name = array_map(function ($val) { |
|
187 | + $name = array_map(function($val) { |
|
188 | 188 | return $this->getTagKey($val); |
189 | 189 | }, $name); |
190 | 190 | $this->tag[$key] = new TagSet($name, $this); |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | */ |
213 | 213 | public function getTagKey(string $tag): string |
214 | 214 | { |
215 | - return $this->options['tag_prefix'] . md5($tag); |
|
215 | + return $this->options['tag_prefix'].md5($tag); |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | /** |
@@ -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 | |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | $this->parseUrlParams($array[2], $param); |
157 | 157 | } |
158 | 158 | |
159 | - return new CallbackDispatch($request, $this, [$namespace . '\\' . Str::studly($class), $method], $param); |
|
159 | + return new CallbackDispatch($request, $this, [$namespace.'\\'.Str::studly($class), $method], $param); |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | /** |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | $this->parseUrlParams($array[1], $param); |
178 | 178 | } |
179 | 179 | |
180 | - return new ControllerDispatch($request, $this, $controller . '/' . $action, $param); |
|
180 | + return new ControllerDispatch($request, $this, $controller.'/'.$action, $param); |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | } |
@@ -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\service; |
14 | 14 | |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | Model::setDb($this->app->db); |
26 | 26 | Model::setEvent($this->app->event); |
27 | 27 | Model::setInvoker([$this->app, 'invoke']); |
28 | - Model::maker(function (Model $model) { |
|
28 | + Model::maker(function(Model $model) { |
|
29 | 29 | $config = $this->app->config; |
30 | 30 | |
31 | 31 | $isAutoWriteTimestamp = $model->getAutoWriteTimestamp(); |
@@ -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\cache\driver; |
14 | 14 | |
@@ -191,8 +191,7 @@ discard block |
||
191 | 191 | $key = $this->getCacheKey($name); |
192 | 192 | |
193 | 193 | return false === $ttl ? |
194 | - $this->handler->delete($key) : |
|
195 | - $this->handler->delete($key, $ttl); |
|
194 | + $this->handler->delete($key) : $this->handler->delete($key, $ttl); |
|
196 | 195 | } |
197 | 196 | |
198 | 197 | /** |
@@ -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 | |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | $rule = '/' != $rule ? ltrim($rule, '/') : ''; |
135 | 135 | |
136 | 136 | if ($this->parent && $prefix = $this->parent->getFullName()) { |
137 | - $rule = $prefix . ($rule ? '/' . ltrim($rule, '/') : ''); |
|
137 | + $rule = $prefix.($rule ? '/'.ltrim($rule, '/') : ''); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | if (false !== strpos($rule, ':')) { |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | |
238 | 238 | if (isset($option['ext'])) { |
239 | 239 | // 路由ext参数 优先于系统配置的URL伪静态后缀参数 |
240 | - $url = preg_replace('/\.(' . $request->ext() . ')$/i', '', $url); |
|
240 | + $url = preg_replace('/\.('.$request->ext().')$/i', '', $url); |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | return $url; |
@@ -261,38 +261,38 @@ discard block |
||
261 | 261 | $pattern = array_merge($this->parent->getPattern(), $this->pattern); |
262 | 262 | |
263 | 263 | // 检查完整规则定义 |
264 | - if (isset($pattern['__url__']) && !preg_match(0 === strpos($pattern['__url__'], '/') ? $pattern['__url__'] : '/^' . $pattern['__url__'] . ($completeMatch ? '$' : '') . '/', str_replace('|', $depr, $url))) { |
|
264 | + if (isset($pattern['__url__']) && !preg_match(0 === strpos($pattern['__url__'], '/') ? $pattern['__url__'] : '/^'.$pattern['__url__'].($completeMatch ? '$' : '').'/', str_replace('|', $depr, $url))) { |
|
265 | 265 | return false; |
266 | 266 | } |
267 | 267 | |
268 | 268 | $var = []; |
269 | - $url = $depr . str_replace('|', $depr, $url); |
|
270 | - $rule = $depr . str_replace('/', $depr, $this->rule); |
|
269 | + $url = $depr.str_replace('|', $depr, $url); |
|
270 | + $rule = $depr.str_replace('/', $depr, $this->rule); |
|
271 | 271 | |
272 | 272 | if ($depr == $rule && $depr != $url) { |
273 | 273 | return false; |
274 | 274 | } |
275 | 275 | |
276 | 276 | if (false === strpos($rule, '<')) { |
277 | - if (0 === strcasecmp($rule, $url) || (!$completeMatch && 0 === strncasecmp($rule . $depr, $url . $depr, strlen($rule . $depr)))) { |
|
277 | + if (0 === strcasecmp($rule, $url) || (!$completeMatch && 0 === strncasecmp($rule.$depr, $url.$depr, strlen($rule.$depr)))) { |
|
278 | 278 | return $var; |
279 | 279 | } |
280 | 280 | return false; |
281 | 281 | } |
282 | 282 | |
283 | - $slash = preg_quote('/-' . $depr, '/'); |
|
283 | + $slash = preg_quote('/-'.$depr, '/'); |
|
284 | 284 | |
285 | - if ($matchRule = preg_split('/[' . $slash . ']?<\w+\??>/', $rule, 2)) { |
|
285 | + if ($matchRule = preg_split('/['.$slash.']?<\w+\??>/', $rule, 2)) { |
|
286 | 286 | if ($matchRule[0] && 0 !== strncasecmp($rule, $url, strlen($matchRule[0]))) { |
287 | 287 | return false; |
288 | 288 | } |
289 | 289 | } |
290 | 290 | |
291 | - if (preg_match_all('/[' . $slash . ']?<?\w+\??>?/', $rule, $matches)) { |
|
291 | + if (preg_match_all('/['.$slash.']?<?\w+\??>?/', $rule, $matches)) { |
|
292 | 292 | $regex = $this->buildRuleRegex($rule, $matches[0], $pattern, $option, $completeMatch); |
293 | 293 | |
294 | 294 | try { |
295 | - if (!preg_match('/^' . $regex . '/u', $url, $match)) { |
|
295 | + if (!preg_match('/^'.$regex.'/u', $url, $match)) { |
|
296 | 296 | return false; |
297 | 297 | } |
298 | 298 | } catch (\Exception $e) { |
@@ -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; |
14 | 14 | |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | public function getConfig(string $name = null, $default = null) |
57 | 57 | { |
58 | 58 | if (!is_null($name)) { |
59 | - return $this->app->config->get('filesystem.' . $name, $default); |
|
59 | + return $this->app->config->get('filesystem.'.$name, $default); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | return $this->app->config->get('filesystem'); |
@@ -55,7 +55,7 @@ |
||
55 | 55 | { |
56 | 56 | $this->config->shouldReceive("get")->with("view.type", 'php')->andReturn(TestTemplate::class); |
57 | 57 | |
58 | - $this->view->filter(function ($content) { |
|
58 | + $this->view->filter(function($content) { |
|
59 | 59 | return $content; |
60 | 60 | }); |
61 | 61 |
@@ -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 | |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | */ |
87 | 87 | public function fetch(string $template = '', array $vars = []): string |
88 | 88 | { |
89 | - return $this->getContent(function () use ($vars, $template) { |
|
89 | + return $this->getContent(function() use ($vars, $template) { |
|
90 | 90 | $this->engine()->fetch($template, array_merge($this->data, $vars)); |
91 | 91 | }); |
92 | 92 | } |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | */ |
101 | 101 | public function display(string $content, array $vars = []): string |
102 | 102 | { |
103 | - return $this->getContent(function () use ($vars, $content) { |
|
103 | + return $this->getContent(function() use ($vars, $content) { |
|
104 | 104 | $this->engine()->display($content, array_merge($this->data, $vars)); |
105 | 105 | }); |
106 | 106 | } |