@@ -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\dispatch; |
14 | 14 | |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | |
54 | 54 | if (strpos($controller, '.')) { |
55 | 55 | $pos = strrpos($controller, '.'); |
56 | - $this->controller = substr($controller, 0, $pos) . '.' . Str::studly(substr($controller, $pos + 1)); |
|
56 | + $this->controller = substr($controller, 0, $pos).'.'.Str::studly(substr($controller, $pos + 1)); |
|
57 | 57 | } else { |
58 | 58 | $this->controller = Str::studly($controller); |
59 | 59 | } |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | // 实例化控制器 |
74 | 74 | $instance = $this->controller($this->controller); |
75 | 75 | } catch (ClassNotFoundException $e) { |
76 | - throw new HttpException(404, 'controller not exists:' . $e->getClass()); |
|
76 | + throw new HttpException(404, 'controller not exists:'.$e->getClass()); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | // 注册控制器中间件 |
@@ -81,10 +81,10 @@ discard block |
||
81 | 81 | |
82 | 82 | return $this->app->middleware->pipeline('controller') |
83 | 83 | ->send($this->request) |
84 | - ->then(function () use ($instance) { |
|
84 | + ->then(function() use ($instance) { |
|
85 | 85 | // 获取当前操作名 |
86 | 86 | $suffix = $this->rule->config('action_suffix'); |
87 | - $action = $this->actionName . $suffix; |
|
87 | + $action = $this->actionName.$suffix; |
|
88 | 88 | |
89 | 89 | if (is_callable([$instance, $action])) { |
90 | 90 | $vars = $this->request->param(); |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | } |
105 | 105 | } else { |
106 | 106 | // 操作不存在 |
107 | - throw new HttpException(404, 'method not exists:' . get_class($instance) . '->' . $action . '()'); |
|
107 | + throw new HttpException(404, 'method not exists:'.get_class($instance).'->'.$action.'()'); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | $data = $this->app->invokeReflectMethod($instance, $reflect, $vars); |
@@ -131,11 +131,11 @@ discard block |
||
131 | 131 | |
132 | 132 | foreach ($middlewares as $key => $val) { |
133 | 133 | if (!is_int($key)) { |
134 | - if (isset($val['only']) && !in_array($this->request->action(true), array_map(function ($item) { |
|
134 | + if (isset($val['only']) && !in_array($this->request->action(true), array_map(function($item) { |
|
135 | 135 | return strtolower($item); |
136 | 136 | }, is_string($val['only']) ? explode(",", $val['only']) : $val['only']))) { |
137 | 137 | continue; |
138 | - } elseif (isset($val['except']) && in_array($this->request->action(true), array_map(function ($item) { |
|
138 | + } elseif (isset($val['except']) && in_array($this->request->action(true), array_map(function($item) { |
|
139 | 139 | return strtolower($item); |
140 | 140 | }, is_string($val['except']) ? explode(',', $val['except']) : $val['except']))) { |
141 | 141 | continue; |
@@ -167,14 +167,14 @@ discard block |
||
167 | 167 | $controllerLayer = $this->rule->config('controller_layer') ?: 'controller'; |
168 | 168 | $emptyController = $this->rule->config('empty_controller') ?: 'Error'; |
169 | 169 | |
170 | - $class = $this->app->parseClass($controllerLayer, $name . $suffix); |
|
170 | + $class = $this->app->parseClass($controllerLayer, $name.$suffix); |
|
171 | 171 | |
172 | 172 | if (class_exists($class)) { |
173 | 173 | return $this->app->make($class, [], true); |
174 | - } elseif ($emptyController && class_exists($emptyClass = $this->app->parseClass($controllerLayer, $emptyController . $suffix))) { |
|
174 | + } elseif ($emptyController && class_exists($emptyClass = $this->app->parseClass($controllerLayer, $emptyController.$suffix))) { |
|
175 | 175 | return $this->app->make($emptyClass, [], true); |
176 | 176 | } |
177 | 177 | |
178 | - throw new ClassNotFoundException('class not exists:' . $class, $class); |
|
178 | + throw new ClassNotFoundException('class not exists:'.$class, $class); |
|
179 | 179 | } |
180 | 180 | } |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | // +---------------------------------------------------------------------- |
9 | 9 | // | Author: Slince <[email protected]> |
10 | 10 | // +---------------------------------------------------------------------- |
11 | -declare (strict_types = 1); |
|
11 | +declare(strict_types=1); |
|
12 | 12 | |
13 | 13 | namespace think; |
14 | 14 | |
@@ -133,8 +133,8 @@ discard block |
||
133 | 133 | public function pipeline(string $type = 'global') |
134 | 134 | { |
135 | 135 | return (new Pipeline()) |
136 | - ->through(array_map(function ($middleware) { |
|
137 | - return function ($request, $next) use ($middleware) { |
|
136 | + ->through(array_map(function($middleware) { |
|
137 | + return function($request, $next) use ($middleware) { |
|
138 | 138 | [$call, $params] = $middleware; |
139 | 139 | if (is_array($call) && is_string($call[0])) { |
140 | 140 | $call = [$this->app->make($call[0]), $call[1]]; |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | protected function sortMiddleware(array $middlewares) |
230 | 230 | { |
231 | 231 | $priority = $this->app->config->get('middleware.priority', []); |
232 | - uasort($middlewares, function ($a, $b) use ($priority) { |
|
232 | + uasort($middlewares, function($a, $b) use ($priority) { |
|
233 | 233 | $aPriority = $this->getMiddlewarePriority($priority, $a); |
234 | 234 | $bPriority = $this->getMiddlewarePriority($priority, $b); |
235 | 235 | return $bPriority - $aPriority; |
@@ -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 && ctype_alnum($id) ? $id : md5(microtime(true) . session_create_id()); |
|
121 | + $this->id = is_string($id) && strlen($id) === 32 && ctype_alnum($id) ? $id : md5(microtime(true).session_create_id()); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | /** |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | // +---------------------------------------------------------------------- |
9 | 9 | // | Author: luofei614 <weibo.com/luofei614> |
10 | 10 | // +---------------------------------------------------------------------- |
11 | -declare (strict_types = 1); |
|
11 | +declare(strict_types=1); |
|
12 | 12 | |
13 | 13 | namespace think\log\driver; |
14 | 14 | |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | if ($this->app->exists('request')) { |
93 | 93 | $currentUri = $this->app->request->url(true); |
94 | 94 | } else { |
95 | - $currentUri = 'cmd:' . implode(' ', $_SERVER['argv'] ?? []); |
|
95 | + $currentUri = 'cmd:'.implode(' ', $_SERVER['argv'] ?? []); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | if (!empty($this->config['format_head'])) { |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | foreach ($log as $type => $val) { |
117 | 117 | $trace[] = [ |
118 | 118 | 'type' => isset($expandLevel[$type]) ? 'group' : 'groupCollapsed', |
119 | - 'msg' => '[ ' . $type . ' ]', |
|
119 | + 'msg' => '[ '.$type.' ]', |
|
120 | 120 | 'css' => $this->css[$type] ?? '', |
121 | 121 | ]; |
122 | 122 | |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | ]; |
203 | 203 | |
204 | 204 | $msg = json_encode($logs, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_PARTIAL_OUTPUT_ON_ERROR); |
205 | - $address = '/' . $clientId; //将client_id作为地址, server端通过地址判断将日志发布给谁 |
|
205 | + $address = '/'.$clientId; //将client_id作为地址, server端通过地址判断将日志发布给谁 |
|
206 | 206 | |
207 | 207 | $this->send($this->config['host'], $this->config['port'], $msg, $address); |
208 | 208 | } |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | */ |
286 | 286 | protected function send($host, $port, $message = '', $address = '/') |
287 | 287 | { |
288 | - $url = 'http://' . $host . ':' . $port . $address; |
|
288 | + $url = 'http://'.$host.':'.$port.$address; |
|
289 | 289 | $ch = curl_init(); |
290 | 290 | |
291 | 291 | curl_setopt($ch, CURLOPT_URL, $url); |
@@ -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 | |
@@ -162,13 +162,13 @@ discard block |
||
162 | 162 | */ |
163 | 163 | public function __construct(string $rootPath = '') |
164 | 164 | { |
165 | - $this->thinkPath = dirname(__DIR__) . DIRECTORY_SEPARATOR; |
|
166 | - $this->rootPath = $rootPath ? rtrim($rootPath, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR : $this->getDefaultRootPath(); |
|
167 | - $this->appPath = $this->rootPath . 'app' . DIRECTORY_SEPARATOR; |
|
168 | - $this->runtimePath = $this->rootPath . 'runtime' . DIRECTORY_SEPARATOR; |
|
165 | + $this->thinkPath = dirname(__DIR__).DIRECTORY_SEPARATOR; |
|
166 | + $this->rootPath = $rootPath ? rtrim($rootPath, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR : $this->getDefaultRootPath(); |
|
167 | + $this->appPath = $this->rootPath.'app'.DIRECTORY_SEPARATOR; |
|
168 | + $this->runtimePath = $this->rootPath.'runtime'.DIRECTORY_SEPARATOR; |
|
169 | 169 | |
170 | - if (is_file($this->appPath . 'provider.php')) { |
|
171 | - $this->bind(include $this->appPath . 'provider.php'); |
|
170 | + if (is_file($this->appPath.'provider.php')) { |
|
171 | + $this->bind(include $this->appPath.'provider.php'); |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | static::setInstance($this); |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | public function getService($service) |
229 | 229 | { |
230 | 230 | $name = is_string($service) ? $service : get_class($service); |
231 | - return array_values(array_filter($this->services, function ($value) use ($name) { |
|
231 | + return array_values(array_filter($this->services, function($value) use ($name) { |
|
232 | 232 | return $value instanceof $name; |
233 | 233 | }, ARRAY_FILTER_USE_BOTH))[0] ?? null; |
234 | 234 | } |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | */ |
305 | 305 | public function getBasePath(): string |
306 | 306 | { |
307 | - return $this->rootPath . 'app' . DIRECTORY_SEPARATOR; |
|
307 | + return $this->rootPath.'app'.DIRECTORY_SEPARATOR; |
|
308 | 308 | } |
309 | 309 | |
310 | 310 | /** |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | */ |
363 | 363 | public function getConfigPath(): string |
364 | 364 | { |
365 | - return $this->rootPath . 'config' . DIRECTORY_SEPARATOR; |
|
365 | + return $this->rootPath.'config'.DIRECTORY_SEPARATOR; |
|
366 | 366 | } |
367 | 367 | |
368 | 368 | /** |
@@ -408,8 +408,8 @@ discard block |
||
408 | 408 | $this->beginMem = memory_get_usage(); |
409 | 409 | |
410 | 410 | // 加载环境变量 |
411 | - if (is_file($this->rootPath . '.env')) { |
|
412 | - $this->env->load($this->rootPath . '.env'); |
|
411 | + if (is_file($this->rootPath.'.env')) { |
|
412 | + $this->env->load($this->rootPath.'.env'); |
|
413 | 413 | } |
414 | 414 | |
415 | 415 | $this->configExt = $this->env->get('config_ext', '.php'); |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | // 加载框架默认语言包 |
423 | 423 | $langSet = $this->lang->defaultLangSet(); |
424 | 424 | |
425 | - $this->lang->load($this->thinkPath . 'lang' . DIRECTORY_SEPARATOR . $langSet . '.php'); |
|
425 | + $this->lang->load($this->thinkPath.'lang'.DIRECTORY_SEPARATOR.$langSet.'.php'); |
|
426 | 426 | |
427 | 427 | // 加载应用默认语言包 |
428 | 428 | $this->loadLangPack($langSet); |
@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | } |
462 | 462 | |
463 | 463 | // 加载系统语言包 |
464 | - $files = glob($this->appPath . 'lang' . DIRECTORY_SEPARATOR . $langset . '.*'); |
|
464 | + $files = glob($this->appPath.'lang'.DIRECTORY_SEPARATOR.$langset.'.*'); |
|
465 | 465 | $this->lang->load($files); |
466 | 466 | |
467 | 467 | // 加载扩展(自定义)语言包 |
@@ -479,7 +479,7 @@ discard block |
||
479 | 479 | */ |
480 | 480 | public function boot(): void |
481 | 481 | { |
482 | - array_walk($this->services, function ($service) { |
|
482 | + array_walk($this->services, function($service) { |
|
483 | 483 | $this->bootService($service); |
484 | 484 | }); |
485 | 485 | } |
@@ -493,30 +493,30 @@ discard block |
||
493 | 493 | { |
494 | 494 | $appPath = $this->getAppPath(); |
495 | 495 | |
496 | - if (is_file($appPath . 'common.php')) { |
|
497 | - include_once $appPath . 'common.php'; |
|
496 | + if (is_file($appPath.'common.php')) { |
|
497 | + include_once $appPath.'common.php'; |
|
498 | 498 | } |
499 | 499 | |
500 | - include_once $this->thinkPath . 'helper.php'; |
|
500 | + include_once $this->thinkPath.'helper.php'; |
|
501 | 501 | |
502 | 502 | $configPath = $this->getConfigPath(); |
503 | 503 | |
504 | 504 | $files = []; |
505 | 505 | |
506 | 506 | if (is_dir($configPath)) { |
507 | - $files = glob($configPath . '*' . $this->configExt); |
|
507 | + $files = glob($configPath.'*'.$this->configExt); |
|
508 | 508 | } |
509 | 509 | |
510 | 510 | foreach ($files as $file) { |
511 | 511 | $this->config->load($file, pathinfo($file, PATHINFO_FILENAME)); |
512 | 512 | } |
513 | 513 | |
514 | - if (is_file($appPath . 'event.php')) { |
|
515 | - $this->loadEvent(include $appPath . 'event.php'); |
|
514 | + if (is_file($appPath.'event.php')) { |
|
515 | + $this->loadEvent(include $appPath.'event.php'); |
|
516 | 516 | } |
517 | 517 | |
518 | - if (is_file($appPath . 'service.php')) { |
|
519 | - $services = include $appPath . 'service.php'; |
|
518 | + if (is_file($appPath.'service.php')) { |
|
519 | + $services = include $appPath.'service.php'; |
|
520 | 520 | foreach ($services as $service) { |
521 | 521 | $this->register($service); |
522 | 522 | } |
@@ -581,9 +581,9 @@ discard block |
||
581 | 581 | $name = str_replace(['/', '.'], '\\', $name); |
582 | 582 | $array = explode('\\', $name); |
583 | 583 | $class = Str::studly(array_pop($array)); |
584 | - $path = $array ? implode('\\', $array) . '\\' : ''; |
|
584 | + $path = $array ? implode('\\', $array).'\\' : ''; |
|
585 | 585 | |
586 | - return $this->namespace . '\\' . $layer . '\\' . $path . $class; |
|
586 | + return $this->namespace.'\\'.$layer.'\\'.$path.$class; |
|
587 | 587 | } |
588 | 588 | |
589 | 589 | /** |
@@ -602,7 +602,7 @@ discard block |
||
602 | 602 | */ |
603 | 603 | protected function getDefaultRootPath(): string |
604 | 604 | { |
605 | - return dirname($this->thinkPath, 4) . DIRECTORY_SEPARATOR; |
|
605 | + return dirname($this->thinkPath, 4).DIRECTORY_SEPARATOR; |
|
606 | 606 | } |
607 | 607 | |
608 | 608 | } |
@@ -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 | - $this->clear($path . $file . DIRECTORY_SEPARATOR, $rmdir); |
|
54 | + if ('.' != $file && '..' != $file && is_dir($path.$file)) { |
|
55 | + $this->clear($path.$file.DIRECTORY_SEPARATOR, $rmdir); |
|
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: liu21st <[email protected]> |
10 | 10 | // +---------------------------------------------------------------------- |
11 | -declare (strict_types = 1); |
|
11 | +declare(strict_types=1); |
|
12 | 12 | |
13 | 13 | //------------------------ |
14 | 14 | // ThinkPHP 助手函数 |
@@ -190,12 +190,12 @@ discard block |
||
190 | 190 | $output = preg_replace('/\]\=\>\n(\s+)/m', '] => ', $output); |
191 | 191 | |
192 | 192 | if (PHP_SAPI == 'cli') { |
193 | - $output = PHP_EOL . $output . PHP_EOL; |
|
193 | + $output = PHP_EOL.$output.PHP_EOL; |
|
194 | 194 | } else { |
195 | 195 | if (!extension_loaded('xdebug')) { |
196 | 196 | $output = htmlspecialchars($output, ENT_SUBSTITUTE); |
197 | 197 | } |
198 | - $output = '<pre>' . $output . '</pre>'; |
|
198 | + $output = '<pre>'.$output.'</pre>'; |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | echo $output; |
@@ -274,8 +274,7 @@ discard block |
||
274 | 274 | } |
275 | 275 | |
276 | 276 | return isset($has) ? |
277 | - request()->has($key, $method) : |
|
278 | - request()->$method($key, $default, $filter); |
|
277 | + request()->has($key, $method) : request()->$method($key, $default, $filter); |
|
279 | 278 | } |
280 | 279 | } |
281 | 280 | |
@@ -352,7 +351,7 @@ discard block |
||
352 | 351 | function parse_name(string $name, int $type = 0, bool $ucfirst = true): string |
353 | 352 | { |
354 | 353 | if ($type) { |
355 | - $name = preg_replace_callback('/_([a-zA-Z])/', function ($match) { |
|
354 | + $name = preg_replace_callback('/_([a-zA-Z])/', function($match) { |
|
356 | 355 | return strtoupper($match[1]); |
357 | 356 | }, $name); |
358 | 357 | |
@@ -453,7 +452,7 @@ discard block |
||
453 | 452 | { |
454 | 453 | $token = Request::buildToken($name, $type); |
455 | 454 | |
456 | - return '<input type="hidden" name="' . $name . '" value="' . $token . '" />'; |
|
455 | + return '<input type="hidden" name="'.$name.'" value="'.$token.'" />'; |
|
457 | 456 | } |
458 | 457 | } |
459 | 458 | |
@@ -468,7 +467,7 @@ discard block |
||
468 | 467 | { |
469 | 468 | $token = Request::buildToken($name, $type); |
470 | 469 | |
471 | - return '<meta name="csrf-token" content="' . $token . '">'; |
|
470 | + return '<meta name="csrf-token" content="'.$token.'">'; |
|
472 | 471 | } |
473 | 472 | } |
474 | 473 | |
@@ -593,7 +592,7 @@ discard block |
||
593 | 592 | */ |
594 | 593 | function app_path($path = '') |
595 | 594 | { |
596 | - return app()->getAppPath() . ($path ? $path . DIRECTORY_SEPARATOR : $path); |
|
595 | + return app()->getAppPath().($path ? $path.DIRECTORY_SEPARATOR : $path); |
|
597 | 596 | } |
598 | 597 | } |
599 | 598 | |
@@ -606,7 +605,7 @@ discard block |
||
606 | 605 | */ |
607 | 606 | function base_path($path = '') |
608 | 607 | { |
609 | - return app()->getBasePath() . ($path ? $path . DIRECTORY_SEPARATOR : $path); |
|
608 | + return app()->getBasePath().($path ? $path.DIRECTORY_SEPARATOR : $path); |
|
610 | 609 | } |
611 | 610 | } |
612 | 611 | |
@@ -619,7 +618,7 @@ discard block |
||
619 | 618 | */ |
620 | 619 | function config_path($path = '') |
621 | 620 | { |
622 | - return app()->getConfigPath() . ($path ? $path . DIRECTORY_SEPARATOR : $path); |
|
621 | + return app()->getConfigPath().($path ? $path.DIRECTORY_SEPARATOR : $path); |
|
623 | 622 | } |
624 | 623 | } |
625 | 624 | |
@@ -632,7 +631,7 @@ discard block |
||
632 | 631 | */ |
633 | 632 | function public_path($path = '') |
634 | 633 | { |
635 | - return app()->getRootPath() . 'public' . DIRECTORY_SEPARATOR . ($path ? ltrim($path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR : $path); |
|
634 | + return app()->getRootPath().'public'.DIRECTORY_SEPARATOR.($path ? ltrim($path, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR : $path); |
|
636 | 635 | } |
637 | 636 | } |
638 | 637 | |
@@ -645,7 +644,7 @@ discard block |
||
645 | 644 | */ |
646 | 645 | function runtime_path($path = '') |
647 | 646 | { |
648 | - return app()->getRuntimePath() . ($path ? $path . DIRECTORY_SEPARATOR : $path); |
|
647 | + return app()->getRuntimePath().($path ? $path.DIRECTORY_SEPARATOR : $path); |
|
649 | 648 | } |
650 | 649 | } |
651 | 650 | |
@@ -658,6 +657,6 @@ discard block |
||
658 | 657 | */ |
659 | 658 | function root_path($path = '') |
660 | 659 | { |
661 | - return app()->getRootPath() . ($path ? $path . DIRECTORY_SEPARATOR : $path); |
|
660 | + return app()->getRootPath().($path ? $path.DIRECTORY_SEPARATOR : $path); |
|
662 | 661 | } |
663 | 662 | } |
@@ -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\console; |
14 | 14 | |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | |
75 | 75 | public function __construct($driver = 'console') |
76 | 76 | { |
77 | - $class = '\\think\\console\\output\\driver\\' . ucwords($driver); |
|
77 | + $class = '\\think\\console\\output\\driver\\'.ucwords($driver); |
|
78 | 78 | |
79 | 79 | $this->handle = new $class($this); |
80 | 80 | } |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | if ($this->handle && method_exists($this->handle, $method)) { |
226 | 226 | return call_user_func_array([$this->handle, $method], $args); |
227 | 227 | } else { |
228 | - throw new Exception('method not exists:' . __CLASS__ . '->' . $method); |
|
228 | + throw new Exception('method not exists:'.__CLASS__.'->'.$method); |
|
229 | 229 | } |
230 | 230 | } |
231 | 231 | } |
@@ -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\response; |
14 | 14 | |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | protected function output($data) |
42 | 42 | { |
43 | 43 | if (!$this->isContent && !is_file($data)) { |
44 | - throw new Exception('file not exists:' . $data); |
|
44 | + throw new Exception('file not exists:'.$data); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | ob_end_clean(); |
@@ -62,13 +62,13 @@ discard block |
||
62 | 62 | |
63 | 63 | $this->header['Pragma'] = 'public'; |
64 | 64 | $this->header['Content-Type'] = $mimeType ?: 'application/octet-stream'; |
65 | - $this->header['Cache-control'] = 'max-age=' . $this->expire; |
|
66 | - $this->header['Content-Disposition'] = ($this->force ? 'attachment; ' : '') . 'filename="' . $name . '"'; |
|
65 | + $this->header['Cache-control'] = 'max-age='.$this->expire; |
|
66 | + $this->header['Content-Disposition'] = ($this->force ? 'attachment; ' : '').'filename="'.$name.'"'; |
|
67 | 67 | $this->header['Content-Length'] = $size; |
68 | 68 | $this->header['Content-Transfer-Encoding'] = 'binary'; |
69 | - $this->header['Expires'] = gmdate("D, d M Y H:i:s", time() + $this->expire) . ' GMT'; |
|
69 | + $this->header['Expires'] = gmdate("D, d M Y H:i:s", time() + $this->expire).' GMT'; |
|
70 | 70 | |
71 | - $this->lastModified(gmdate('D, d M Y H:i:s', time()) . ' GMT'); |
|
71 | + $this->lastModified(gmdate('D, d M Y H:i:s', time()).' GMT'); |
|
72 | 72 | |
73 | 73 | return $this->isContent ? $data : file_get_contents($data); |
74 | 74 | } |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | $this->name = $filename; |
150 | 150 | |
151 | 151 | if ($extension && false === strpos($filename, '.')) { |
152 | - $this->name .= '.' . pathinfo($this->data, PATHINFO_EXTENSION); |
|
152 | + $this->name .= '.'.pathinfo($this->data, PATHINFO_EXTENSION); |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | return $this; |