@@ -8,7 +8,7 @@ |
||
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\filesystem; |
14 | 14 |
@@ -86,7 +86,7 @@ |
||
86 | 86 | $stream = fopen($file->getRealPath(), 'r'); |
87 | 87 | |
88 | 88 | $result = $this->putStream( |
89 | - $path = trim($path . '/' . $name, '/'), $stream, $options |
|
89 | + $path = trim($path.'/'.$name, '/'), $stream, $options |
|
90 | 90 | ); |
91 | 91 | |
92 | 92 | if (is_resource($stream)) { |
@@ -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\view\driver; |
14 | 14 | |
@@ -77,14 +77,14 @@ discard block |
||
77 | 77 | |
78 | 78 | // 模板不存在 抛出异常 |
79 | 79 | if (!is_file($template)) { |
80 | - throw new TemplateNotFoundException('template not exists:' . $template, $template); |
|
80 | + throw new TemplateNotFoundException('template not exists:'.$template, $template); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | $this->template = $template; |
84 | 84 | |
85 | 85 | // 记录视图信息 |
86 | 86 | $this->app->log |
87 | - ->record('[ VIEW ] ' . $template . ' [ ' . var_export(array_keys($data), true) . ' ]'); |
|
87 | + ->record('[ VIEW ] '.$template.' [ '.var_export(array_keys($data), true).' ]'); |
|
88 | 88 | |
89 | 89 | extract($data, EXTR_OVERWRITE); |
90 | 90 | |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | $this->content = $content; |
104 | 104 | |
105 | 105 | extract($data, EXTR_OVERWRITE); |
106 | - eval('?>' . $this->content); |
|
106 | + eval('?>'.$this->content); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | /** |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | private function parseTemplate(string $template): string |
116 | 116 | { |
117 | 117 | if (empty($this->config['view_path'])) { |
118 | - $this->config['view_path'] = $this->app->getAppPath() . 'view' . DIRECTORY_SEPARATOR; |
|
118 | + $this->config['view_path'] = $this->app->getAppPath().'view'.DIRECTORY_SEPARATOR; |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | $request = $this->app->request; |
@@ -129,9 +129,9 @@ discard block |
||
129 | 129 | if ($this->config['view_base']) { |
130 | 130 | // 基础视图目录 |
131 | 131 | $app = isset($app) ? $app : $request->app(); |
132 | - $path = $this->config['view_base'] . ($app ? $app . DIRECTORY_SEPARATOR : ''); |
|
132 | + $path = $this->config['view_base'].($app ? $app.DIRECTORY_SEPARATOR : ''); |
|
133 | 133 | } else { |
134 | - $path = isset($app) ? $this->app->getBasePath() . $app . DIRECTORY_SEPARATOR . 'view' . DIRECTORY_SEPARATOR : $this->config['view_path']; |
|
134 | + $path = isset($app) ? $this->app->getBasePath().$app.DIRECTORY_SEPARATOR.'view'.DIRECTORY_SEPARATOR : $this->config['view_path']; |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | $depr = $this->config['view_depr']; |
@@ -151,16 +151,16 @@ discard block |
||
151 | 151 | $template = App::parseName($request->action()); |
152 | 152 | } |
153 | 153 | |
154 | - $template = str_replace('.', DIRECTORY_SEPARATOR, $controller) . $depr . $template; |
|
154 | + $template = str_replace('.', DIRECTORY_SEPARATOR, $controller).$depr.$template; |
|
155 | 155 | } elseif (false === strpos($template, $depr)) { |
156 | - $template = str_replace('.', DIRECTORY_SEPARATOR, $controller) . $depr . $template; |
|
156 | + $template = str_replace('.', DIRECTORY_SEPARATOR, $controller).$depr.$template; |
|
157 | 157 | } |
158 | 158 | } |
159 | 159 | } else { |
160 | 160 | $template = str_replace(['/', ':'], $depr, substr($template, 1)); |
161 | 161 | } |
162 | 162 | |
163 | - return $path . ltrim($template, '/') . '.' . ltrim($this->config['view_suffix'], '.'); |
|
163 | + return $path.ltrim($template, '/').'.'.ltrim($this->config['view_suffix'], '.'); |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | /** |
@@ -8,7 +8,7 @@ |
||
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\facade; |
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\log\driver; |
14 | 14 | |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | $msg = var_export($msg, true); |
82 | 82 | } |
83 | 83 | |
84 | - $info[$type][] = $this->config['json'] ? $msg : '[ ' . $type . ' ] ' . $msg; |
|
84 | + $info[$type][] = $this->config['json'] ? $msg : '[ '.$type.' ] '.$msg; |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | if (!$this->config['json'] && (true === $this->config['apart_level'] || in_array($type, $this->config['apart_level']))) { |
@@ -143,13 +143,13 @@ discard block |
||
143 | 143 | protected function getMasterLogFile(): string |
144 | 144 | { |
145 | 145 | if (empty($this->config['path'])) { |
146 | - $this->config['path'] = $this->app->getRuntimePath() . 'log' . DIRECTORY_SEPARATOR; |
|
146 | + $this->config['path'] = $this->app->getRuntimePath().'log'.DIRECTORY_SEPARATOR; |
|
147 | 147 | } elseif (substr($this->config['path'], -1) != DIRECTORY_SEPARATOR) { |
148 | 148 | $this->config['path'] .= DIRECTORY_SEPARATOR; |
149 | 149 | } |
150 | 150 | |
151 | 151 | if ($this->config['max_files']) { |
152 | - $files = glob($this->config['path'] . '*.log'); |
|
152 | + $files = glob($this->config['path'].'*.log'); |
|
153 | 153 | |
154 | 154 | try { |
155 | 155 | if (count($files) > $this->config['max_files']) { |
@@ -163,17 +163,17 @@ discard block |
||
163 | 163 | if ($this->config['single']) { |
164 | 164 | $name = is_string($this->config['single']) ? $this->config['single'] : 'single'; |
165 | 165 | |
166 | - $destination = $this->config['path'] . $name . '.log'; |
|
166 | + $destination = $this->config['path'].$name.'.log'; |
|
167 | 167 | } else { |
168 | 168 | $cli = $this->isCli ? '_cli' : ''; |
169 | 169 | |
170 | 170 | if ($this->config['max_files']) { |
171 | - $filename = date('Ymd') . $cli . '.log'; |
|
171 | + $filename = date('Ymd').$cli.'.log'; |
|
172 | 172 | } else { |
173 | - $filename = date('Ym') . DIRECTORY_SEPARATOR . date('d') . $cli . '.log'; |
|
173 | + $filename = date('Ym').DIRECTORY_SEPARATOR.date('d').$cli.'.log'; |
|
174 | 174 | } |
175 | 175 | |
176 | - $destination = $this->config['path'] . $filename; |
|
176 | + $destination = $this->config['path'].$filename; |
|
177 | 177 | } |
178 | 178 | |
179 | 179 | return $destination; |
@@ -193,14 +193,14 @@ discard block |
||
193 | 193 | if ($this->config['single']) { |
194 | 194 | $name = is_string($this->config['single']) ? $this->config['single'] : 'single'; |
195 | 195 | |
196 | - $name .= '_' . $type; |
|
196 | + $name .= '_'.$type; |
|
197 | 197 | } elseif ($this->config['max_files']) { |
198 | - $name = date('Ymd') . '_' . $type . $cli; |
|
198 | + $name = date('Ymd').'_'.$type.$cli; |
|
199 | 199 | } else { |
200 | - $name = date('d') . '_' . $type . $cli; |
|
200 | + $name = date('d').'_'.$type.$cli; |
|
201 | 201 | } |
202 | 202 | |
203 | - return $path . DIRECTORY_SEPARATOR . $name . '.log'; |
|
203 | + return $path.DIRECTORY_SEPARATOR.$name.'.log'; |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | /** |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | { |
214 | 214 | if (is_file($destination) && floor($this->config['file_size']) <= filesize($destination)) { |
215 | 215 | try { |
216 | - rename($destination, dirname($destination) . DIRECTORY_SEPARATOR . time() . '-' . basename($destination)); |
|
216 | + rename($destination, dirname($destination).DIRECTORY_SEPARATOR.time().'-'.basename($destination)); |
|
217 | 217 | } catch (\Exception $e) { |
218 | 218 | // |
219 | 219 | } |
@@ -229,14 +229,14 @@ discard block |
||
229 | 229 | protected function parseCliLog(array $info): string |
230 | 230 | { |
231 | 231 | if ($this->config['json']) { |
232 | - $message = json_encode($info, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . PHP_EOL; |
|
232 | + $message = json_encode($info, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES).PHP_EOL; |
|
233 | 233 | } else { |
234 | 234 | $now = $info['timestamp']; |
235 | 235 | unset($info['timestamp']); |
236 | 236 | |
237 | 237 | $message = implode(PHP_EOL, $info); |
238 | 238 | |
239 | - $message = "[{$now}]" . $message . PHP_EOL; |
|
239 | + $message = "[{$now}]".$message.PHP_EOL; |
|
240 | 240 | } |
241 | 241 | |
242 | 242 | return $message; |
@@ -259,13 +259,13 @@ discard block |
||
259 | 259 | |
260 | 260 | if ($this->config['json']) { |
261 | 261 | $info = $requestInfo + $info; |
262 | - return json_encode($info, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . PHP_EOL; |
|
262 | + return json_encode($info, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES).PHP_EOL; |
|
263 | 263 | } |
264 | 264 | |
265 | - array_unshift($info, "---------------------------------------------------------------" . PHP_EOL . "[{$info['timestamp']}] {$requestInfo['ip']} {$requestInfo['method']} {$requestInfo['host']}{$requestInfo['uri']}"); |
|
265 | + array_unshift($info, "---------------------------------------------------------------".PHP_EOL."[{$info['timestamp']}] {$requestInfo['ip']} {$requestInfo['method']} {$requestInfo['host']}{$requestInfo['uri']}"); |
|
266 | 266 | unset($info['timestamp']); |
267 | 267 | |
268 | - return implode(PHP_EOL, $info) . PHP_EOL; |
|
268 | + return implode(PHP_EOL, $info).PHP_EOL; |
|
269 | 269 | } |
270 | 270 | |
271 | 271 | protected function getDebugLog(&$info, $append, $apart): void |
@@ -280,9 +280,9 @@ discard block |
||
280 | 280 | $memory_use = number_format((memory_get_usage() - $this->app->getBeginMem()) / 1024, 2); |
281 | 281 | |
282 | 282 | $info = [ |
283 | - 'runtime' => number_format($runtime, 6) . 's', |
|
284 | - 'reqs' => $reqs . 'req/s', |
|
285 | - 'memory' => $memory_use . 'kb', |
|
283 | + 'runtime' => number_format($runtime, 6).'s', |
|
284 | + 'reqs' => $reqs.'req/s', |
|
285 | + 'memory' => $memory_use.'kb', |
|
286 | 286 | 'file' => count(get_included_files()), |
287 | 287 | ] + $info; |
288 | 288 | |
@@ -293,11 +293,11 @@ discard block |
||
293 | 293 | |
294 | 294 | $memory_use = number_format((memory_get_usage() - $this->app->getBeginMem()) / 1024, 2); |
295 | 295 | |
296 | - $time_str = '[运行时间:' . number_format($runtime, 6) . 's] [吞吐率:' . $reqs . 'req/s]'; |
|
297 | - $memory_str = ' [内存消耗:' . $memory_use . 'kb]'; |
|
298 | - $file_load = ' [文件加载:' . count(get_included_files()) . ']'; |
|
296 | + $time_str = '[运行时间:'.number_format($runtime, 6).'s] [吞吐率:'.$reqs.'req/s]'; |
|
297 | + $memory_str = ' [内存消耗:'.$memory_use.'kb]'; |
|
298 | + $file_load = ' [文件加载:'.count(get_included_files()).']'; |
|
299 | 299 | |
300 | - array_unshift($info, $time_str . $memory_str . $file_load); |
|
300 | + array_unshift($info, $time_str.$memory_str.$file_load); |
|
301 | 301 | } |
302 | 302 | } |
303 | 303 | } |
@@ -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 | |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | */ |
82 | 82 | public function getCacheKey(string $name): string |
83 | 83 | { |
84 | - return $this->options['prefix'] . $name; |
|
84 | + return $this->options['prefix'].$name; |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | /** |
@@ -142,14 +142,14 @@ discard block |
||
142 | 142 | |
143 | 143 | $time = time(); |
144 | 144 | |
145 | - while ($time + 5 > time() && $this->has($name . '_lock')) { |
|
145 | + while ($time + 5 > time() && $this->has($name.'_lock')) { |
|
146 | 146 | // 存在锁定则等待 |
147 | 147 | usleep(200000); |
148 | 148 | } |
149 | 149 | |
150 | 150 | try { |
151 | 151 | // 锁定 |
152 | - $this->set($name . '_lock', true); |
|
152 | + $this->set($name.'_lock', true); |
|
153 | 153 | |
154 | 154 | if ($value instanceof \Closure) { |
155 | 155 | // 获取缓存数据 |
@@ -160,9 +160,9 @@ discard block |
||
160 | 160 | $this->set($name, $value, $expire); |
161 | 161 | |
162 | 162 | // 解锁 |
163 | - $this->delete($name . '_lock'); |
|
163 | + $this->delete($name.'_lock'); |
|
164 | 164 | } catch (\Exception | \throwable $e) { |
165 | - $this->delete($name . '_lock'); |
|
165 | + $this->delete($name.'_lock'); |
|
166 | 166 | throw $e; |
167 | 167 | } |
168 | 168 | |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | $key = implode('-', $name); |
182 | 182 | |
183 | 183 | if (!isset($this->tag[$key])) { |
184 | - $name = array_map(function ($val) { |
|
184 | + $name = array_map(function($val) { |
|
185 | 185 | return $this->getTagKey($val); |
186 | 186 | }, $name); |
187 | 187 | $this->tag[$key] = new TagSet($name, $this); |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | */ |
211 | 211 | public function getTagKey(string $tag): string |
212 | 212 | { |
213 | - return $this->options['tag_prefix'] . md5($tag); |
|
213 | + return $this->options['tag_prefix'].md5($tag); |
|
214 | 214 | } |
215 | 215 | |
216 | 216 | /** |
@@ -55,7 +55,7 @@ |
||
55 | 55 | $this->handler = new \Redis; |
56 | 56 | |
57 | 57 | if ($this->options['persistent']) { |
58 | - $this->handler->pconnect($this->options['host'], (int) $this->options['port'], $this->options['timeout'], 'persistent_id_' . $this->options['select']); |
|
58 | + $this->handler->pconnect($this->options['host'], (int) $this->options['port'], $this->options['timeout'], 'persistent_id_'.$this->options['select']); |
|
59 | 59 | } else { |
60 | 60 | $this->handler->connect($this->options['host'], (int) $this->options['port'], $this->options['timeout']); |
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\cache\driver; |
14 | 14 | |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | } |
55 | 55 | |
56 | 56 | if (empty($this->options['path'])) { |
57 | - $this->options['path'] = $app->getRuntimePath() . 'cache' . DIRECTORY_SEPARATOR; |
|
57 | + $this->options['path'] = $app->getRuntimePath().'cache'.DIRECTORY_SEPARATOR; |
|
58 | 58 | } elseif (substr($this->options['path'], -1) != DIRECTORY_SEPARATOR) { |
59 | 59 | $this->options['path'] .= DIRECTORY_SEPARATOR; |
60 | 60 | } |
@@ -72,14 +72,14 @@ discard block |
||
72 | 72 | |
73 | 73 | if ($this->options['cache_subdir']) { |
74 | 74 | // 使用子目录 |
75 | - $name = substr($name, 0, 2) . DIRECTORY_SEPARATOR . substr($name, 2); |
|
75 | + $name = substr($name, 0, 2).DIRECTORY_SEPARATOR.substr($name, 2); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | if ($this->options['prefix']) { |
79 | - $name = $this->options['prefix'] . DIRECTORY_SEPARATOR . $name; |
|
79 | + $name = $this->options['prefix'].DIRECTORY_SEPARATOR.$name; |
|
80 | 80 | } |
81 | 81 | |
82 | - return $this->options['path'] . $name . '.php'; |
|
82 | + return $this->options['path'].$name.'.php'; |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | /** |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | $data = gzcompress($data, 3); |
171 | 171 | } |
172 | 172 | |
173 | - $data = "<?php\n//" . sprintf('%012d', $expire) . "\n exit();?>\n" . $data; |
|
173 | + $data = "<?php\n//".sprintf('%012d', $expire)."\n exit();?>\n".$data; |
|
174 | 174 | $result = file_put_contents($filename, $data); |
175 | 175 | |
176 | 176 | if ($result) { |
@@ -247,11 +247,11 @@ discard block |
||
247 | 247 | { |
248 | 248 | $this->writeTimes++; |
249 | 249 | |
250 | - $files = (array) glob($this->options['path'] . ($this->options['prefix'] ? $this->options['prefix'] . DIRECTORY_SEPARATOR : '') . '*'); |
|
250 | + $files = (array) glob($this->options['path'].($this->options['prefix'] ? $this->options['prefix'].DIRECTORY_SEPARATOR : '').'*'); |
|
251 | 251 | |
252 | 252 | foreach ($files as $path) { |
253 | 253 | if (is_dir($path)) { |
254 | - $matches = glob($path . DIRECTORY_SEPARATOR . '*.php'); |
|
254 | + $matches = glob($path.DIRECTORY_SEPARATOR.'*.php'); |
|
255 | 255 | if (is_array($matches)) { |
256 | 256 | array_map('unlink', $matches); |
257 | 257 | } |
@@ -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\cache; |
14 | 14 |