@@ -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 | |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | public function __construct(App $app) |
| 56 | 56 | { |
| 57 | 57 | $this->app = $app; |
| 58 | - $this->multi = is_dir($this->app->getBasePath() . 'controller') ? false : true; |
|
| 58 | + $this->multi = is_dir($this->app->getBasePath().'controller') ? false : true; |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | /** |
@@ -171,8 +171,8 @@ discard block |
||
| 171 | 171 | $this->initialize(); |
| 172 | 172 | |
| 173 | 173 | // 加载全局中间件 |
| 174 | - if (is_file($this->app->getBasePath() . 'middleware.php')) { |
|
| 175 | - $this->app->middleware->import(include $this->app->getBasePath() . 'middleware.php'); |
|
| 174 | + if (is_file($this->app->getBasePath().'middleware.php')) { |
|
| 175 | + $this->app->middleware->import(include $this->app->getBasePath().'middleware.php'); |
|
| 176 | 176 | } |
| 177 | 177 | |
| 178 | 178 | if ($this->multi) { |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | // 监听HttpRun |
| 186 | 186 | $this->app->event->trigger('HttpRun'); |
| 187 | 187 | |
| 188 | - $withRoute = $this->app->config->get('app.with_route', true) ? function () { |
|
| 188 | + $withRoute = $this->app->config->get('app.with_route', true) ? function() { |
|
| 189 | 189 | $this->loadRoutes(); |
| 190 | 190 | } : null; |
| 191 | 191 | |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | { |
| 202 | 202 | // 加载路由定义 |
| 203 | 203 | if (is_dir($this->getRoutePath())) { |
| 204 | - $files = glob($this->getRoutePath() . '*.php'); |
|
| 204 | + $files = glob($this->getRoutePath().'*.php'); |
|
| 205 | 205 | foreach ($files as $file) { |
| 206 | 206 | include $file; |
| 207 | 207 | } |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | $this->app->console->call('route:build', [$this->name]); |
| 214 | 214 | } |
| 215 | 215 | |
| 216 | - $filename = $this->app->getRuntimePath() . 'build_route.php'; |
|
| 216 | + $filename = $this->app->getRuntimePath().'build_route.php'; |
|
| 217 | 217 | |
| 218 | 218 | if (is_file($filename)) { |
| 219 | 219 | include $filename; |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | */ |
| 229 | 229 | protected function getRoutePath(): string |
| 230 | 230 | { |
| 231 | - return $this->app->getRootPath() . 'route' . DIRECTORY_SEPARATOR . ($this->isMulti() ? $this->getName() . DIRECTORY_SEPARATOR : ''); |
|
| 231 | + return $this->app->getRootPath().'route'.DIRECTORY_SEPARATOR.($this->isMulti() ? $this->getName().DIRECTORY_SEPARATOR : ''); |
|
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | /** |
@@ -313,7 +313,7 @@ discard block |
||
| 313 | 313 | $appName = $map[$name]; |
| 314 | 314 | } |
| 315 | 315 | } elseif ($name && (false !== array_search($name, $map) || in_array($name, $deny))) { |
| 316 | - throw new HttpException(404, 'app not exists:' . $name); |
|
| 316 | + throw new HttpException(404, 'app not exists:'.$name); |
|
| 317 | 317 | } elseif ($name && isset($map['*'])) { |
| 318 | 318 | $appName = $map['*']; |
| 319 | 319 | } else { |
@@ -321,7 +321,7 @@ discard block |
||
| 321 | 321 | } |
| 322 | 322 | |
| 323 | 323 | if ($name) { |
| 324 | - $this->app->request->setRoot('/' . $name); |
|
| 324 | + $this->app->request->setRoot('/'.$name); |
|
| 325 | 325 | $this->app->request->setPathinfo(strpos($path, '/') ? ltrim(strstr($path, '/'), '/') : ''); |
| 326 | 326 | } |
| 327 | 327 | } |
@@ -341,41 +341,41 @@ discard block |
||
| 341 | 341 | { |
| 342 | 342 | $this->name = $appName; |
| 343 | 343 | $this->app->request->setApp($appName); |
| 344 | - $this->app->setAppPath($this->path ?: $this->app->getBasePath() . $appName . DIRECTORY_SEPARATOR); |
|
| 345 | - $this->app->setRuntimePath($this->app->getRootPath() . 'runtime' . DIRECTORY_SEPARATOR . $appName . DIRECTORY_SEPARATOR); |
|
| 344 | + $this->app->setAppPath($this->path ?: $this->app->getBasePath().$appName.DIRECTORY_SEPARATOR); |
|
| 345 | + $this->app->setRuntimePath($this->app->getRootPath().'runtime'.DIRECTORY_SEPARATOR.$appName.DIRECTORY_SEPARATOR); |
|
| 346 | 346 | |
| 347 | 347 | //加载app文件 |
| 348 | 348 | if (is_dir($this->app->getAppPath())) { |
| 349 | 349 | $appPath = $this->app->getAppPath(); |
| 350 | 350 | |
| 351 | - if (is_file($appPath . 'common.php')) { |
|
| 352 | - include_once $appPath . 'common.php'; |
|
| 351 | + if (is_file($appPath.'common.php')) { |
|
| 352 | + include_once $appPath.'common.php'; |
|
| 353 | 353 | } |
| 354 | 354 | |
| 355 | 355 | $configPath = $this->app->getConfigPath(); |
| 356 | 356 | |
| 357 | 357 | $files = []; |
| 358 | 358 | |
| 359 | - if (is_dir($configPath . $appName)) { |
|
| 360 | - $files = array_merge($files, glob($configPath . $appName . DIRECTORY_SEPARATOR . '*' . $this->app->getConfigExt())); |
|
| 361 | - } elseif (is_dir($appPath . 'config')) { |
|
| 362 | - $files = array_merge($files, glob($appPath . 'config' . DIRECTORY_SEPARATOR . '*' . $this->app->getConfigExt())); |
|
| 359 | + if (is_dir($configPath.$appName)) { |
|
| 360 | + $files = array_merge($files, glob($configPath.$appName.DIRECTORY_SEPARATOR.'*'.$this->app->getConfigExt())); |
|
| 361 | + } elseif (is_dir($appPath.'config')) { |
|
| 362 | + $files = array_merge($files, glob($appPath.'config'.DIRECTORY_SEPARATOR.'*'.$this->app->getConfigExt())); |
|
| 363 | 363 | } |
| 364 | 364 | |
| 365 | 365 | foreach ($files as $file) { |
| 366 | 366 | $this->app->config->load($file, pathinfo($file, PATHINFO_FILENAME)); |
| 367 | 367 | } |
| 368 | 368 | |
| 369 | - if (is_file($appPath . 'event.php')) { |
|
| 370 | - $this->app->loadEvent(include $appPath . 'event.php'); |
|
| 369 | + if (is_file($appPath.'event.php')) { |
|
| 370 | + $this->app->loadEvent(include $appPath.'event.php'); |
|
| 371 | 371 | } |
| 372 | 372 | |
| 373 | - if (is_file($appPath . 'middleware.php')) { |
|
| 374 | - $this->app->middleware->import(include $appPath . 'middleware.php'); |
|
| 373 | + if (is_file($appPath.'middleware.php')) { |
|
| 374 | + $this->app->middleware->import(include $appPath.'middleware.php'); |
|
| 375 | 375 | } |
| 376 | 376 | |
| 377 | - if (is_file($appPath . 'provider.php')) { |
|
| 378 | - $this->app->bind(include $appPath . 'provider.php'); |
|
| 377 | + if (is_file($appPath.'provider.php')) { |
|
| 378 | + $this->app->bind(include $appPath.'provider.php'); |
|
| 379 | 379 | } |
| 380 | 380 | } |
| 381 | 381 | |
@@ -383,7 +383,7 @@ discard block |
||
| 383 | 383 | $this->app->loadLangPack($this->app->lang->defaultLangSet()); |
| 384 | 384 | |
| 385 | 385 | // 设置应用命名空间 |
| 386 | - $this->app->setNamespace($this->app->config->get('app.app_namespace') ?: 'app\\' . $appName); |
|
| 386 | + $this->app->setNamespace($this->app->config->get('app.app_namespace') ?: 'app\\'.$appName); |
|
| 387 | 387 | } |
| 388 | 388 | |
| 389 | 389 | /** |
@@ -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 | |
@@ -387,7 +387,7 @@ discard block |
||
| 387 | 387 | $this->data = $data; |
| 388 | 388 | } |
| 389 | 389 | |
| 390 | - $sessionId = md5(microtime(true) . uniqid()); |
|
| 390 | + $sessionId = md5(microtime(true).uniqid()); |
|
| 391 | 391 | |
| 392 | 392 | $this->setId($sessionId); |
| 393 | 393 | return $sessionId; |
@@ -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 | |
@@ -64,8 +64,8 @@ discard block |
||
| 64 | 64 | { |
| 65 | 65 | if (is_file($file)) { |
| 66 | 66 | $filename = $file; |
| 67 | - } elseif (is_file($this->path . $file . $this->ext)) { |
|
| 68 | - $filename = $this->path . $file . $this->ext; |
|
| 67 | + } elseif (is_file($this->path.$file.$this->ext)) { |
|
| 68 | + $filename = $this->path.$file.$this->ext; |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | if (isset($filename)) { |
@@ -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 | /** |