@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | { |
43 | 43 | $dir = $input->getArgument('dir') ?: ''; |
44 | 44 | |
45 | - $filename = $this->app->getRootPath() . 'runtime' . DIRECTORY_SEPARATOR . ($dir ? $dir . DIRECTORY_SEPARATOR : '') . 'route_list.php'; |
|
45 | + $filename = $this->app->getRootPath().'runtime'.DIRECTORY_SEPARATOR.($dir ? $dir.DIRECTORY_SEPARATOR : '').'route_list.php'; |
|
46 | 46 | |
47 | 47 | if (is_file($filename)) { |
48 | 48 | unlink($filename); |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | } |
52 | 52 | |
53 | 53 | $content = $this->getRouteList($dir); |
54 | - file_put_contents($filename, 'Route List' . PHP_EOL . $content); |
|
54 | + file_put_contents($filename, 'Route List'.PHP_EOL.$content); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | protected function getRouteList(string $dir = null): string |
@@ -60,16 +60,16 @@ discard block |
||
60 | 60 | $this->app->route->clear(); |
61 | 61 | |
62 | 62 | if ($dir) { |
63 | - $path = $this->app->getRootPath() . 'route' . DIRECTORY_SEPARATOR . $dir . DIRECTORY_SEPARATOR; |
|
63 | + $path = $this->app->getRootPath().'route'.DIRECTORY_SEPARATOR.$dir.DIRECTORY_SEPARATOR; |
|
64 | 64 | } else { |
65 | - $path = $this->app->getRootPath() . 'route' . DIRECTORY_SEPARATOR; |
|
65 | + $path = $this->app->getRootPath().'route'.DIRECTORY_SEPARATOR; |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | $files = is_dir($path) ? scandir($path) : []; |
69 | 69 | |
70 | 70 | foreach ($files as $file) { |
71 | 71 | if (strpos($file, '.php')) { |
72 | - include $path . $file; |
|
72 | + include $path.$file; |
|
73 | 73 | } |
74 | 74 | } |
75 | 75 | |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | $sort = $this->sortBy[$sort]; |
109 | 109 | } |
110 | 110 | |
111 | - uasort($rows, function ($a, $b) use ($sort) { |
|
111 | + uasort($rows, function($a, $b) use ($sort) { |
|
112 | 112 | $itemA = $a[$sort] ?? null; |
113 | 113 | $itemB = $b[$sort] ?? null; |
114 | 114 |
@@ -64,9 +64,9 @@ discard block |
||
64 | 64 | |
65 | 65 | $this->middleware->add('foo'); |
66 | 66 | $this->assertEquals(3, count($this->middleware->all())); |
67 | - $this->middleware->add(function () { |
|
67 | + $this->middleware->add(function() { |
|
68 | 68 | }); |
69 | - $this->middleware->add(function () { |
|
69 | + $this->middleware->add(function() { |
|
70 | 70 | }); |
71 | 71 | $this->assertEquals(5, count($this->middleware->all())); |
72 | 72 | } |
@@ -85,10 +85,10 @@ discard block |
||
85 | 85 | $handle->shouldReceive('report')->with($e)->andReturnNull(); |
86 | 86 | $handle->shouldReceive('render')->with($request, $e)->andReturn($response); |
87 | 87 | |
88 | - $foo->shouldReceive('handle')->once()->andReturnUsing(function ($request, $next) { |
|
88 | + $foo->shouldReceive('handle')->once()->andReturnUsing(function($request, $next) { |
|
89 | 89 | return $next($request); |
90 | 90 | }); |
91 | - $bar->shouldReceive('handle')->once()->andReturnUsing(function ($request, $next) use ($e) { |
|
91 | + $bar->shouldReceive('handle')->once()->andReturnUsing(function($request, $next) use ($e) { |
|
92 | 92 | $next($request); |
93 | 93 | throw $e; |
94 | 94 | }); |
@@ -99,13 +99,13 @@ discard block |
||
99 | 99 | |
100 | 100 | $this->config->shouldReceive('get')->once()->with('middleware.priority', [])->andReturn(['FooMiddleware', 'BarMiddleware']); |
101 | 101 | |
102 | - $this->middleware->import([function ($request, $next) { |
|
102 | + $this->middleware->import([function($request, $next) { |
|
103 | 103 | return $next($request); |
104 | 104 | }, 'BarMiddleware', 'FooMiddleware']); |
105 | 105 | |
106 | 106 | $this->assertInstanceOf(Pipeline::class, $pipeline = $this->middleware->pipeline()); |
107 | 107 | |
108 | - $pipeline->send($request)->then(function ($request) use ($e, $response) { |
|
108 | + $pipeline->send($request)->then(function($request) use ($e, $response) { |
|
109 | 109 | throw $e; |
110 | 110 | }); |
111 | 111 |
@@ -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\session\driver; |
14 | 14 | |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | $this->config = array_merge($this->config, $config); |
40 | 40 | |
41 | 41 | if (empty($this->config['path'])) { |
42 | - $this->config['path'] = $app->getRootPath() . 'runtime' . DIRECTORY_SEPARATOR . 'session' . DIRECTORY_SEPARATOR; |
|
42 | + $this->config['path'] = $app->getRootPath().'runtime'.DIRECTORY_SEPARATOR.'session'.DIRECTORY_SEPARATOR; |
|
43 | 43 | } elseif (substr($this->config['path'], -1) != DIRECTORY_SEPARATOR) { |
44 | 44 | $this->config['path'] .= DIRECTORY_SEPARATOR; |
45 | 45 | } |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | $lifetime = $this->config['expire']; |
77 | 77 | $now = time(); |
78 | 78 | |
79 | - $files = $this->findFiles($this->config['path'], function (SplFileInfo $item) use ($lifetime, $now) { |
|
79 | + $files = $this->findFiles($this->config['path'], function(SplFileInfo $item) use ($lifetime, $now) { |
|
80 | 80 | return $now - $lifetime > $item->getMTime(); |
81 | 81 | }); |
82 | 82 | |
@@ -118,12 +118,12 @@ discard block |
||
118 | 118 | { |
119 | 119 | if ($this->config['prefix']) { |
120 | 120 | // 使用子目录 |
121 | - $name = $this->config['prefix'] . DIRECTORY_SEPARATOR . 'sess_' . $name; |
|
121 | + $name = $this->config['prefix'].DIRECTORY_SEPARATOR.'sess_'.$name; |
|
122 | 122 | } else { |
123 | - $name = 'sess_' . $name; |
|
123 | + $name = 'sess_'.$name; |
|
124 | 124 | } |
125 | 125 | |
126 | - $filename = $this->config['path'] . $name; |
|
126 | + $filename = $this->config['path'].$name; |
|
127 | 127 | $dir = dirname($filename); |
128 | 128 | |
129 | 129 | if ($auto && !is_dir($dir)) { |
@@ -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 | |
@@ -160,9 +160,9 @@ discard block |
||
160 | 160 | $this->ruleName = new RuleName(); |
161 | 161 | $this->setDefaultDomain(); |
162 | 162 | |
163 | - if (is_file($this->app->getRuntimePath() . 'route.php')) { |
|
163 | + if (is_file($this->app->getRuntimePath().'route.php')) { |
|
164 | 164 | // 读取路由映射文件 |
165 | - $this->import(include $this->app->getRuntimePath() . 'route.php'); |
|
165 | + $this->import(include $this->app->getRuntimePath().'route.php'); |
|
166 | 166 | } |
167 | 167 | } |
168 | 168 | |
@@ -392,14 +392,14 @@ discard block |
||
392 | 392 | if (is_null($domain)) { |
393 | 393 | $domain = $this->host; |
394 | 394 | } elseif (false === strpos($domain, '.') && $this->request) { |
395 | - $domain .= '.' . $this->request->rootDomain(); |
|
395 | + $domain .= '.'.$this->request->rootDomain(); |
|
396 | 396 | } |
397 | 397 | |
398 | 398 | if ($this->request) { |
399 | 399 | $subDomain = $this->request->subDomain(); |
400 | 400 | |
401 | 401 | if (strpos($subDomain, '.')) { |
402 | - $name = '*' . strstr($subDomain, '.'); |
|
402 | + $name = '*'.strstr($subDomain, '.'); |
|
403 | 403 | } |
404 | 404 | } |
405 | 405 | |
@@ -743,7 +743,7 @@ discard block |
||
743 | 743 | |
744 | 744 | return $this->app->middleware->pipeline('route') |
745 | 745 | ->send($request) |
746 | - ->then(function () use ($dispatch) { |
|
746 | + ->then(function() use ($dispatch) { |
|
747 | 747 | return $dispatch->run(); |
748 | 748 | }); |
749 | 749 | } |
@@ -792,10 +792,10 @@ discard block |
||
792 | 792 | $path = $pathinfo; |
793 | 793 | } elseif ($suffix) { |
794 | 794 | // 去除正常的URL后缀 |
795 | - $path = preg_replace('/\.(' . ltrim($suffix, '.') . ')$/i', '', $pathinfo); |
|
795 | + $path = preg_replace('/\.('.ltrim($suffix, '.').')$/i', '', $pathinfo); |
|
796 | 796 | } else { |
797 | 797 | // 允许任何后缀访问 |
798 | - $path = preg_replace('/\.' . $this->request->ext() . '$/i', '', $pathinfo); |
|
798 | + $path = preg_replace('/\.'.$this->request->ext().'$/i', '', $pathinfo); |
|
799 | 799 | } |
800 | 800 | |
801 | 801 | return $path; |
@@ -838,9 +838,9 @@ discard block |
||
838 | 838 | $item = $this->domains[$this->host]; |
839 | 839 | } elseif (isset($this->domains[$subDomain])) { |
840 | 840 | $item = $this->domains[$subDomain]; |
841 | - } elseif (isset($this->domains['*.' . $domain2]) && !empty($domain3)) { |
|
841 | + } elseif (isset($this->domains['*.'.$domain2]) && !empty($domain3)) { |
|
842 | 842 | // 泛三级域名 |
843 | - $item = $this->domains['*.' . $domain2]; |
|
843 | + $item = $this->domains['*.'.$domain2]; |
|
844 | 844 | $panDomain = $domain3; |
845 | 845 | } elseif (isset($this->domains['*']) && !empty($domain2)) { |
846 | 846 | // 泛二级域名 |
@@ -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 | |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | protected function resolveClass(string $type): string |
94 | 94 | { |
95 | 95 | if ($this->namespace || false !== strpos($type, '\\')) { |
96 | - $class = false !== strpos($type, '\\') ? $type : $this->namespace . Str::studly($type); |
|
96 | + $class = false !== strpos($type, '\\') ? $type : $this->namespace.Str::studly($type); |
|
97 | 97 | |
98 | 98 | if (class_exists($class)) { |
99 | 99 | return $class; |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | { |
126 | 126 | $type = $this->resolveType($name); |
127 | 127 | |
128 | - $method = 'create' . Str::studly($type) . 'Driver'; |
|
128 | + $method = 'create'.Str::studly($type).'Driver'; |
|
129 | 129 | |
130 | 130 | $params = $this->resolveParams($name); |
131 | 131 |
@@ -13,7 +13,7 @@ |
||
13 | 13 | public function __construct(string $message, string $func = '', Throwable $previous = null) |
14 | 14 | { |
15 | 15 | $this->message = $message; |
16 | - $this->func = $func; |
|
16 | + $this->func = $func; |
|
17 | 17 | |
18 | 18 | parent::__construct($message, 0, $previous); |
19 | 19 | } |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | |
64 | 64 | Container::setInstance($container); |
65 | 65 | |
66 | - $container->bind('name', function () { |
|
66 | + $container->bind('name', function() { |
|
67 | 67 | return 'Taylor'; |
68 | 68 | }); |
69 | 69 | |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | $this->expectExceptionMessage('class not exists: name'); |
81 | 81 | $container->get('name'); |
82 | 82 | |
83 | - $container->bind('name', function () { |
|
83 | + $container->bind('name', function() { |
|
84 | 84 | return 'Taylor'; |
85 | 85 | }); |
86 | 86 | |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | { |
92 | 92 | $container = new Container; |
93 | 93 | |
94 | - $container->bind('name', function () { |
|
94 | + $container->bind('name', function() { |
|
95 | 95 | return 'Taylor'; |
96 | 96 | }); |
97 | 97 | |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | { |
107 | 107 | $container = new Container; |
108 | 108 | |
109 | - $container->bind('name', function () { |
|
109 | + $container->bind('name', function() { |
|
110 | 110 | return 'Taylor'; |
111 | 111 | }); |
112 | 112 | |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | |
199 | 199 | $this->assertSame($object, Container::getInstance()); |
200 | 200 | |
201 | - Container::setInstance(function () { |
|
201 | + Container::setInstance(function() { |
|
202 | 202 | return $this; |
203 | 203 | }); |
204 | 204 | |
@@ -210,10 +210,10 @@ discard block |
||
210 | 210 | $container = new Container(); |
211 | 211 | $container->bind(Container::class, $container); |
212 | 212 | |
213 | - $container->resolving(function (SomeClass $taylor, Container $container) { |
|
213 | + $container->resolving(function(SomeClass $taylor, Container $container) { |
|
214 | 214 | $taylor->count++; |
215 | 215 | }); |
216 | - $container->resolving(SomeClass::class, function (SomeClass $taylor, Container $container) { |
|
216 | + $container->resolving(SomeClass::class, function(SomeClass $taylor, Container $container) { |
|
217 | 217 | $taylor->count++; |
218 | 218 | }); |
219 | 219 | |
@@ -252,19 +252,19 @@ discard block |
||
252 | 252 | |
253 | 253 | $this->assertEquals('48', $container->invoke('ord', ['0'])); |
254 | 254 | |
255 | - $this->assertSame($container, $container->invoke(Taylor::class . '::test', [])); |
|
255 | + $this->assertSame($container, $container->invoke(Taylor::class.'::test', [])); |
|
256 | 256 | |
257 | - $this->assertSame($container, $container->invokeMethod(Taylor::class . '::test')); |
|
257 | + $this->assertSame($container, $container->invokeMethod(Taylor::class.'::test')); |
|
258 | 258 | |
259 | 259 | $reflect = new ReflectionMethod($container, 'exists'); |
260 | 260 | |
261 | 261 | $this->assertTrue($container->invokeReflectMethod($container, $reflect, [Container::class])); |
262 | 262 | |
263 | - $this->assertSame($container, $container->invoke(function (Container $container) { |
|
263 | + $this->assertSame($container, $container->invoke(function(Container $container) { |
|
264 | 264 | return $container; |
265 | 265 | })); |
266 | 266 | |
267 | - $this->assertSame($container, $container->invoke(Taylor::class . '::test')); |
|
267 | + $this->assertSame($container, $container->invoke(Taylor::class.'::test')); |
|
268 | 268 | |
269 | 269 | $object = $container->invokeClass(SomeClass::class); |
270 | 270 | $this->assertInstanceOf(SomeClass::class, $object); |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | |
273 | 273 | $stdClass = new stdClass(); |
274 | 274 | |
275 | - $container->invoke(function (Container $container, stdClass $stdObject, $key1, $lowKey, $key2 = 'default') use ($stdClass) { |
|
275 | + $container->invoke(function(Container $container, stdClass $stdObject, $key1, $lowKey, $key2 = 'default') use ($stdClass) { |
|
276 | 276 | $this->assertEquals('value1', $key1); |
277 | 277 | $this->assertEquals('default', $key2); |
278 | 278 | $this->assertEquals('value2', $lowKey); |
@@ -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 | |
@@ -88,9 +88,9 @@ discard block |
||
88 | 88 | |
89 | 89 | if (isset($key) && 200 == $response->getCode() && $response->isAllowCache()) { |
90 | 90 | $header = $response->getHeader(); |
91 | - $header['Cache-Control'] = 'max-age=' . $expire . ',must-revalidate'; |
|
92 | - $header['Last-Modified'] = gmdate('D, d M Y H:i:s') . ' GMT'; |
|
93 | - $header['Expires'] = gmdate('D, d M Y H:i:s', time() + $expire) . ' GMT'; |
|
91 | + $header['Cache-Control'] = 'max-age='.$expire.',must-revalidate'; |
|
92 | + $header['Last-Modified'] = gmdate('D, d M Y H:i:s').' GMT'; |
|
93 | + $header['Expires'] = gmdate('D, d M Y H:i:s', time() + $expire).' GMT'; |
|
94 | 94 | |
95 | 95 | $this->cache->tag($tag)->set($key, [$response->getContent(), $header, time()], $expire); |
96 | 96 | } |
@@ -141,12 +141,12 @@ discard block |
||
141 | 141 | if (false !== strpos($key, ':')) { |
142 | 142 | $param = $request->param(); |
143 | 143 | foreach ($param as $item => $val) { |
144 | - if (is_string($val) && false !== strpos($key, ':' . $item)) { |
|
145 | - $key = str_replace(':' . $item, $val, $key); |
|
144 | + if (is_string($val) && false !== strpos($key, ':'.$item)) { |
|
145 | + $key = str_replace(':'.$item, $val, $key); |
|
146 | 146 | } |
147 | 147 | } |
148 | 148 | } elseif (strpos($key, ']')) { |
149 | - if ('[' . $request->ext() . ']' == $key) { |
|
149 | + if ('['.$request->ext().']' == $key) { |
|
150 | 150 | // 缓存某个后缀的请求 |
151 | 151 | $key = md5($request->url()); |
152 | 152 | } else { |
@@ -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 |