@@ -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 | } |
@@ -43,11 +43,11 @@ |
||
43 | 43 | $this->config = m::mock(Config::class)->makePartial(); |
44 | 44 | |
45 | 45 | $this->app->shouldReceive('get')->with('config')->andReturn($this->config); |
46 | - $handlerClass = "\\think\\session\\driver\\Test" . Str::random(10); |
|
46 | + $handlerClass = "\\think\\session\\driver\\Test".Str::random(10); |
|
47 | 47 | $this->config->shouldReceive("get")->with("session.type", "file")->andReturn($handlerClass); |
48 | 48 | $this->session = new Session($this->app); |
49 | 49 | |
50 | - $this->handler = m::mock('overload:' . $handlerClass, SessionHandlerInterface::class); |
|
50 | + $this->handler = m::mock('overload:'.$handlerClass, SessionHandlerInterface::class); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | public function testLoadData() |
@@ -35,16 +35,16 @@ |
||
35 | 35 | |
36 | 36 | public function read(string $sessionId): string |
37 | 37 | { |
38 | - return (string) $this->handler->get($this->prefix . $sessionId); |
|
38 | + return (string) $this->handler->get($this->prefix.$sessionId); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | public function delete(string $sessionId): bool |
42 | 42 | { |
43 | - return $this->handler->delete($this->prefix . $sessionId); |
|
43 | + return $this->handler->delete($this->prefix.$sessionId); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | public function write(string $sessionId, string $data): bool |
47 | 47 | { |
48 | - return $this->handler->set($this->prefix . $sessionId, $data, $this->expire); |
|
48 | + return $this->handler->set($this->prefix.$sessionId, $data, $this->expire); |
|
49 | 49 | } |
50 | 50 | } |
@@ -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 | |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | public function getConfig(string $name = null, $default = null) |
42 | 42 | { |
43 | 43 | if (!is_null($name)) { |
44 | - return $this->app->config->get('session.' . $name, $default); |
|
44 | + return $this->app->config->get('session.'.$name, $default); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | return $this->app->config->get('session'); |
@@ -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\middleware; |
14 | 14 | |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | if ($this->lang->defaultLangSet() != $langset) { |
49 | 49 | // 加载系统语言包 |
50 | 50 | $this->lang->load([ |
51 | - $this->app->getThinkPath() . 'lang' . DIRECTORY_SEPARATOR . $langset . '.php', |
|
51 | + $this->app->getThinkPath().'lang'.DIRECTORY_SEPARATOR.$langset.'.php', |
|
52 | 52 | ]); |
53 | 53 | |
54 | 54 | $this->app->LoadLangPack($langset); |