@@ -30,18 +30,18 @@ discard block |
||
30 | 30 | |
31 | 31 | protected function execute(Input $input, Output $output) |
32 | 32 | { |
33 | - $runtimePath = $this->app->getRootPath() . 'runtime' . DIRECTORY_SEPARATOR; |
|
33 | + $runtimePath = $this->app->getRootPath().'runtime'.DIRECTORY_SEPARATOR; |
|
34 | 34 | |
35 | 35 | if ($input->getOption('cache')) { |
36 | - $path = $runtimePath . 'cache'; |
|
36 | + $path = $runtimePath.'cache'; |
|
37 | 37 | } elseif ($input->getOption('log')) { |
38 | - $path = $runtimePath . 'log'; |
|
38 | + $path = $runtimePath.'log'; |
|
39 | 39 | } else { |
40 | 40 | $path = $input->getOption('path') ?: $runtimePath; |
41 | 41 | } |
42 | 42 | |
43 | 43 | $rmdir = $input->getOption('dir') ? true : false; |
44 | - $this->clear(rtrim($path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR, $rmdir); |
|
44 | + $this->clear(rtrim($path, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR, $rmdir); |
|
45 | 45 | |
46 | 46 | $output->writeln("<info>Clear Successed</info>"); |
47 | 47 | } |
@@ -51,13 +51,13 @@ discard block |
||
51 | 51 | $files = is_dir($path) ? scandir($path) : []; |
52 | 52 | |
53 | 53 | foreach ($files as $file) { |
54 | - if ('.' != $file && '..' != $file && is_dir($path . $file)) { |
|
55 | - array_map('unlink', glob($path . $file . DIRECTORY_SEPARATOR . '*.*')); |
|
54 | + if ('.' != $file && '..' != $file && is_dir($path.$file)) { |
|
55 | + array_map('unlink', glob($path.$file.DIRECTORY_SEPARATOR.'*.*')); |
|
56 | 56 | if ($rmdir) { |
57 | - rmdir($path . $file); |
|
57 | + rmdir($path.$file); |
|
58 | 58 | } |
59 | - } elseif ('.gitignore' != $file && is_file($path . $file)) { |
|
60 | - unlink($path . $file); |
|
59 | + } elseif ('.gitignore' != $file && is_file($path.$file)) { |
|
60 | + unlink($path.$file); |
|
61 | 61 | } |
62 | 62 | } |
63 | 63 | } |
@@ -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 |
@@ -118,7 +118,7 @@ |
||
118 | 118 | */ |
119 | 119 | public function setId($id = null): void |
120 | 120 | { |
121 | - $this->id = is_string($id) && strlen($id) === 32 ? $id : md5(microtime(true) . session_create_id()); |
|
121 | + $this->id = is_string($id) && strlen($id) === 32 ? $id : md5(microtime(true).session_create_id()); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | /** |
@@ -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 | |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | */ |
103 | 103 | public static function create($data = '', string $type = 'html', int $code = 200): Response |
104 | 104 | { |
105 | - $class = false !== strpos($type, '\\') ? $type : '\\think\\response\\' . ucfirst(strtolower($type)); |
|
105 | + $class = false !== strpos($type, '\\') ? $type : '\\think\\response\\'.ucfirst(strtolower($type)); |
|
106 | 106 | |
107 | 107 | return Container::getInstance()->invokeClass($class, [$data, $code]); |
108 | 108 | } |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | http_response_code($this->code); |
136 | 136 | // 发送头部信息 |
137 | 137 | foreach ($this->header as $name => $val) { |
138 | - header($name . (!is_null($val) ? ':' . $val : '')); |
|
138 | + header($name.(!is_null($val) ? ':'.$val : '')); |
|
139 | 139 | } |
140 | 140 | } |
141 | 141 | if ($this->cookie) { |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | */ |
345 | 345 | public function contentType(string $contentType, string $charset = 'utf-8') |
346 | 346 | { |
347 | - $this->header['Content-Type'] = $contentType . '; charset=' . $charset; |
|
347 | + $this->header['Content-Type'] = $contentType.'; charset='.$charset; |
|
348 | 348 | |
349 | 349 | return $this; |
350 | 350 | } |
@@ -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 | |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | $this->handler = new \Redis; |
59 | 59 | |
60 | 60 | if ($this->options['persistent']) { |
61 | - $this->handler->pconnect($this->options['host'], (int) $this->options['port'], (int) $this->options['timeout'], 'persistent_id_' . $this->options['select']); |
|
61 | + $this->handler->pconnect($this->options['host'], (int) $this->options['port'], (int) $this->options['timeout'], 'persistent_id_'.$this->options['select']); |
|
62 | 62 | } else { |
63 | 63 | $this->handler->connect($this->options['host'], (int) $this->options['port'], (int) $this->options['timeout']); |
64 | 64 | } |