@@ -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 | |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | { |
| 98 | 98 | $target = $this->getTargetFile($directory, $name); |
| 99 | 99 | |
| 100 | - set_error_handler(function ($type, $msg) use (&$error) { |
|
| 100 | + set_error_handler(function($type, $msg) use (&$error) { |
|
| 101 | 101 | $error = $msg; |
| 102 | 102 | }); |
| 103 | 103 | $renamed = rename($this->getPathname(), (string) $target); |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | throw new FileException(sprintf('Unable to write in the "%s" directory', $directory)); |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | - $target = rtrim($directory, '/\\') . \DIRECTORY_SEPARATOR . (null === $name ? $this->getBasename() : $this->getName($name)); |
|
| 130 | + $target = rtrim($directory, '/\\').\DIRECTORY_SEPARATOR.(null === $name ? $this->getBasename() : $this->getName($name)); |
|
| 131 | 131 | |
| 132 | 132 | return new self($target, false); |
| 133 | 133 | } |
@@ -170,18 +170,18 @@ discard block |
||
| 170 | 170 | switch (true) { |
| 171 | 171 | case in_array($rule, hash_algos()): |
| 172 | 172 | $hash = $this->hash($rule); |
| 173 | - $this->hashName = substr($hash, 0, 2) . DIRECTORY_SEPARATOR . substr($hash, 2); |
|
| 173 | + $this->hashName = substr($hash, 0, 2).DIRECTORY_SEPARATOR.substr($hash, 2); |
|
| 174 | 174 | break; |
| 175 | 175 | case is_callable($rule): |
| 176 | 176 | $this->hashName = call_user_func($rule); |
| 177 | 177 | break; |
| 178 | 178 | default: |
| 179 | - $this->hashName = date('Ymd') . DIRECTORY_SEPARATOR . md5((string) microtime(true)); |
|
| 179 | + $this->hashName = date('Ymd').DIRECTORY_SEPARATOR.md5((string) microtime(true)); |
|
| 180 | 180 | break; |
| 181 | 181 | } |
| 182 | 182 | } |
| 183 | 183 | } |
| 184 | 184 | |
| 185 | - return $this->hashName . '.' . $this->extension(); |
|
| 185 | + return $this->hashName.'.'.$this->extension(); |
|
| 186 | 186 | } |
| 187 | 187 | } |
@@ -29,9 +29,9 @@ discard block |
||
| 29 | 29 | { |
| 30 | 30 | $dir = $input->getArgument('dir') ?: ''; |
| 31 | 31 | |
| 32 | - $path = $this->app->getRootPath() . 'runtime' . DIRECTORY_SEPARATOR . ($dir ? $dir . DIRECTORY_SEPARATOR : ''); |
|
| 32 | + $path = $this->app->getRootPath().'runtime'.DIRECTORY_SEPARATOR.($dir ? $dir.DIRECTORY_SEPARATOR : ''); |
|
| 33 | 33 | |
| 34 | - $filename = $path . 'route.php'; |
|
| 34 | + $filename = $path.'route.php'; |
|
| 35 | 35 | if (is_file($filename)) { |
| 36 | 36 | unlink($filename); |
| 37 | 37 | } |
@@ -46,21 +46,21 @@ discard block |
||
| 46 | 46 | $this->app->route->lazy(false); |
| 47 | 47 | |
| 48 | 48 | // 路由检测 |
| 49 | - $path = $this->app->getRootPath() . ($dir ? 'app' . DIRECTORY_SEPARATOR . $dir . DIRECTORY_SEPARATOR : '') . 'route' . DIRECTORY_SEPARATOR ; |
|
| 49 | + $path = $this->app->getRootPath().($dir ? 'app'.DIRECTORY_SEPARATOR.$dir.DIRECTORY_SEPARATOR : '').'route'.DIRECTORY_SEPARATOR; |
|
| 50 | 50 | |
| 51 | 51 | $files = is_dir($path) ? scandir($path) : []; |
| 52 | 52 | |
| 53 | 53 | foreach ($files as $file) { |
| 54 | 54 | if (strpos($file, '.php')) { |
| 55 | - include $path . $file; |
|
| 55 | + include $path.$file; |
|
| 56 | 56 | } |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | //触发路由载入完成事件 |
| 60 | 60 | $this->app->event->trigger(RouteLoaded::class); |
| 61 | 61 | |
| 62 | - $content = '<?php ' . PHP_EOL . 'return '; |
|
| 63 | - $content .= '\Opis\Closure\unserialize(\'' . \Opis\Closure\serialize($this->app->route->getName()) . '\');'; |
|
| 62 | + $content = '<?php '.PHP_EOL.'return '; |
|
| 63 | + $content .= '\Opis\Closure\unserialize(\''.\Opis\Closure\serialize($this->app->route->getName()).'\');'; |
|
| 64 | 64 | return $content; |
| 65 | 65 | } |
| 66 | 66 | |
@@ -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\exception; |
| 14 | 14 | |
@@ -72,12 +72,12 @@ discard block |
||
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | if ($this->app->config->get('log.record_trace')) { |
| 75 | - $log .= PHP_EOL . $exception->getTraceAsString(); |
|
| 75 | + $log .= PHP_EOL.$exception->getTraceAsString(); |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | try { |
| 79 | 79 | $this->app->log->record($log, 'error'); |
| 80 | - } catch (Exception $e){} |
|
| 80 | + } catch (Exception $e) {} |
|
| 81 | 81 | } |
| 82 | 82 | } |
| 83 | 83 | |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | ob_start(); |
| 224 | 224 | $data = $this->convertExceptionToArray($exception); |
| 225 | 225 | extract($data); |
| 226 | - include $this->app->config->get('app.exception_tmpl') ?: __DIR__ . '/../../tpl/think_exception.tpl'; |
|
| 226 | + include $this->app->config->get('app.exception_tmpl') ?: __DIR__.'/../../tpl/think_exception.tpl'; |
|
| 227 | 227 | |
| 228 | 228 | return ob_get_clean(); |
| 229 | 229 | } |
@@ -265,10 +265,10 @@ discard block |
||
| 265 | 265 | |
| 266 | 266 | if (strpos($message, ':')) { |
| 267 | 267 | $name = strstr($message, ':', true); |
| 268 | - $message = $lang->has($name) ? $lang->get($name) . strstr($message, ':') : $message; |
|
| 268 | + $message = $lang->has($name) ? $lang->get($name).strstr($message, ':') : $message; |
|
| 269 | 269 | } elseif (strpos($message, ',')) { |
| 270 | 270 | $name = strstr($message, ',', true); |
| 271 | - $message = $lang->has($name) ? $lang->get($name) . ':' . substr(strstr($message, ','), 1) : $message; |
|
| 271 | + $message = $lang->has($name) ? $lang->get($name).':'.substr(strstr($message, ','), 1) : $message; |
|
| 272 | 272 | } elseif ($lang->has($message)) { |
| 273 | 273 | $message = $lang->get($message); |
| 274 | 274 | } |
@@ -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\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->isForceDownload ? 'attachment; ' : '') . 'filename="' . $name . '"'; |
|
| 65 | + $this->header['Cache-control'] = 'max-age='.$this->expire; |
|
| 66 | + $this->header['Content-Disposition'] = ($this->isForceDownload ? '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; |
@@ -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 | } |