@@ -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 | |
@@ -70,15 +70,15 @@ discard block |
||
70 | 70 | // 实例化控制器 |
71 | 71 | $instance = $this->controller($this->controller); |
72 | 72 | } catch (ClassNotFoundException $e) { |
73 | - throw new HttpException(404, 'controller not exists:' . $e->getClass()); |
|
73 | + throw new HttpException(404, 'controller not exists:'.$e->getClass()); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | // 注册控制器中间件 |
77 | 77 | $this->registerControllerMiddleware($instance); |
78 | 78 | |
79 | - $this->app->middleware->controller(function (Request $request, $next) use ($instance) { |
|
79 | + $this->app->middleware->controller(function(Request $request, $next) use ($instance) { |
|
80 | 80 | // 获取当前操作名 |
81 | - $action = $this->actionName . $this->rule->config('action_suffix'); |
|
81 | + $action = $this->actionName.$this->rule->config('action_suffix'); |
|
82 | 82 | |
83 | 83 | if (is_callable([$instance, $action])) { |
84 | 84 | // 自动获取请求变量 |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | } |
97 | 97 | } else { |
98 | 98 | // 操作不存在 |
99 | - throw new HttpException(404, 'method not exists:' . get_class($instance) . '->' . $action . '()'); |
|
99 | + throw new HttpException(404, 'method not exists:'.get_class($instance).'->'.$action.'()'); |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | $data = $this->app->invokeReflectMethod($instance, $reflect, $vars); |
@@ -125,11 +125,11 @@ discard block |
||
125 | 125 | |
126 | 126 | foreach ($middlewares as $key => $val) { |
127 | 127 | if (!is_int($key)) { |
128 | - if (isset($val['only']) && !in_array($this->request->action(true), array_map(function ($item) { |
|
128 | + if (isset($val['only']) && !in_array($this->request->action(true), array_map(function($item) { |
|
129 | 129 | return strtolower($item); |
130 | 130 | }, $val['only']))) { |
131 | 131 | continue; |
132 | - } elseif (isset($val['except']) && in_array($this->request->action(true), array_map(function ($item) { |
|
132 | + } elseif (isset($val['except']) && in_array($this->request->action(true), array_map(function($item) { |
|
133 | 133 | return strtolower($item); |
134 | 134 | }, $val['except']))) { |
135 | 135 | continue; |
@@ -157,14 +157,14 @@ discard block |
||
157 | 157 | $controllerLayer = $this->rule->config('controller_layer') ?: 'controller'; |
158 | 158 | $emptyController = $this->rule->config('empty_controller') ?: 'Error'; |
159 | 159 | |
160 | - $class = $this->app->parseClass($controllerLayer, $name . $suffix); |
|
160 | + $class = $this->app->parseClass($controllerLayer, $name.$suffix); |
|
161 | 161 | |
162 | 162 | if (class_exists($class)) { |
163 | 163 | return $this->app->make($class, [], true); |
164 | - } elseif ($emptyController && class_exists($emptyClass = $this->app->parseClass($controllerLayer, $emptyController . $suffix))) { |
|
164 | + } elseif ($emptyController && class_exists($emptyClass = $this->app->parseClass($controllerLayer, $emptyController.$suffix))) { |
|
165 | 165 | return $this->app->make($emptyClass, [], true); |
166 | 166 | } |
167 | 167 | |
168 | - throw new ClassNotFoundException('class not exists:' . $class, $class); |
|
168 | + throw new ClassNotFoundException('class not exists:'.$class, $class); |
|
169 | 169 | } |
170 | 170 | } |
@@ -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\service; |
14 | 14 | |
@@ -30,15 +30,15 @@ discard block |
||
30 | 30 | |
31 | 31 | public function boot() |
32 | 32 | { |
33 | - Paginator::maker(function (...$args) { |
|
33 | + Paginator::maker(function(...$args) { |
|
34 | 34 | return $this->app->make(Paginator::class, $args, true); |
35 | 35 | }); |
36 | 36 | |
37 | - Paginator::currentPathResolver(function () { |
|
37 | + Paginator::currentPathResolver(function() { |
|
38 | 38 | return $this->app->request->baseUrl(); |
39 | 39 | }); |
40 | 40 | |
41 | - Paginator::currentPageResolver(function ($varPage = 'page') { |
|
41 | + Paginator::currentPageResolver(function($varPage = 'page') { |
|
42 | 42 | |
43 | 43 | $page = $this->app->request->param($varPage); |
44 | 44 |
@@ -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\service; |
14 | 14 | |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | { |
23 | 23 | public function boot() |
24 | 24 | { |
25 | - Validate::maker(function (Validate $validate) { |
|
25 | + Validate::maker(function(Validate $validate) { |
|
26 | 26 | $validate->setLang($this->app->lang); |
27 | 27 | $validate->setDb($this->app->db); |
28 | 28 | $validate->setRequest($this->app->request); |
@@ -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\service; |
14 | 14 | |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | { |
23 | 23 | public function boot() |
24 | 24 | { |
25 | - Model::maker(function (Model $model) { |
|
25 | + Model::maker(function(Model $model) { |
|
26 | 26 | $db = $this->app->db; |
27 | 27 | $config = $this->app->config; |
28 | 28 | $model->setDb($db); |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | proc_close($process); |
232 | 232 | |
233 | 233 | if (preg_match('/--------+\r?\n.+?(\d+)\r?\n.+?(\d+)\r?\n/', $info, $matches)) { |
234 | - return $matches[2] . 'x' . $matches[1]; |
|
234 | + return $matches[2].'x'.$matches[1]; |
|
235 | 235 | } |
236 | 236 | } |
237 | 237 | return; |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | $lines = []; |
265 | 265 | $line = ''; |
266 | 266 | foreach (preg_split('//u', $utf8String) as $char) { |
267 | - if (mb_strwidth($line . $char, 'utf8') <= $width) { |
|
267 | + if (mb_strwidth($line.$char, 'utf8') <= $width) { |
|
268 | 268 | $line .= $char; |
269 | 269 | continue; |
270 | 270 | } |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | if (null === $stream) { |
341 | 341 | $stream = $this->stdout; |
342 | 342 | } |
343 | - if (false === @fwrite($stream, $message . ($newline ? PHP_EOL : ''))) { |
|
343 | + if (false === @fwrite($stream, $message.($newline ? PHP_EOL : ''))) { |
|
344 | 344 | throw new \RuntimeException('Unable to write output.'); |
345 | 345 | } |
346 | 346 | |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | { |
357 | 357 | if (DIRECTORY_SEPARATOR === '\\') { |
358 | 358 | return |
359 | - '10.0.10586' === PHP_WINDOWS_VERSION_MAJOR . '.' . PHP_WINDOWS_VERSION_MINOR . '.' . PHP_WINDOWS_VERSION_BUILD |
|
359 | + '10.0.10586' === PHP_WINDOWS_VERSION_MAJOR.'.'.PHP_WINDOWS_VERSION_MINOR.'.'.PHP_WINDOWS_VERSION_BUILD |
|
360 | 360 | || false !== getenv('ANSICON') |
361 | 361 | || 'ON' === getenv('ConEmuANSI') |
362 | 362 | || 'xterm' === getenv('TERM'); |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | $spacingWidth = $totalWidth - strlen($argument->getName()) + 2; |
87 | 87 | |
88 | 88 | $this->writeText(sprintf(" <info>%s</info>%s%s%s", $argument->getName(), str_repeat(' ', $spacingWidth), // + 17 = 2 spaces + <info> + </info> + 2 spaces |
89 | - preg_replace('/\s*\R\s*/', PHP_EOL . str_repeat(' ', $totalWidth + 17), $argument->getDescription()), $default), $options); |
|
89 | + preg_replace('/\s*\R\s*/', PHP_EOL.str_repeat(' ', $totalWidth + 17), $argument->getDescription()), $default), $options); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | /** |
@@ -108,10 +108,10 @@ discard block |
||
108 | 108 | |
109 | 109 | $value = ''; |
110 | 110 | if ($option->acceptValue()) { |
111 | - $value = '=' . strtoupper($option->getName()); |
|
111 | + $value = '='.strtoupper($option->getName()); |
|
112 | 112 | |
113 | 113 | if ($option->isValueOptional()) { |
114 | - $value = '[' . $value . ']'; |
|
114 | + $value = '['.$value.']'; |
|
115 | 115 | } |
116 | 116 | } |
117 | 117 | |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | $spacingWidth = $totalWidth - strlen($synopsis) + 2; |
122 | 122 | |
123 | 123 | $this->writeText(sprintf(" <info>%s</info>%s%s%s%s", $synopsis, str_repeat(' ', $spacingWidth), // + 17 = 2 spaces + <info> + </info> + 2 spaces |
124 | - preg_replace('/\s*\R\s*/', "\n" . str_repeat(' ', $totalWidth + 17), $option->getDescription()), $default, $option->isArray() ? '<comment> (multiple values allowed)</comment>' : ''), $options); |
|
124 | + preg_replace('/\s*\R\s*/', "\n".str_repeat(' ', $totalWidth + 17), $option->getDescription()), $default, $option->isArray() ? '<comment> (multiple values allowed)</comment>' : ''), $options); |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | /** |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | $this->writeText('<comment>Usage:</comment>', $options); |
185 | 185 | foreach (array_merge([$command->getSynopsis(true)], $command->getAliases(), $command->getUsages()) as $usage) { |
186 | 186 | $this->writeText("\n"); |
187 | - $this->writeText(' ' . $usage, $options); |
|
187 | + $this->writeText(' '.$usage, $options); |
|
188 | 188 | } |
189 | 189 | $this->writeText("\n"); |
190 | 190 | |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | $this->writeText("\n"); |
200 | 200 | $this->writeText('<comment>Help:</comment>', $options); |
201 | 201 | $this->writeText("\n"); |
202 | - $this->writeText(' ' . str_replace("\n", "\n ", $help), $options); |
|
202 | + $this->writeText(' '.str_replace("\n", "\n ", $help), $options); |
|
203 | 203 | $this->writeText("\n"); |
204 | 204 | } |
205 | 205 | } |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | foreach ($description->getNamespaces() as $namespace) { |
248 | 248 | if (!$describedNamespace && ConsoleDescription::GLOBAL_NAMESPACE !== $namespace['id']) { |
249 | 249 | $this->writeText("\n"); |
250 | - $this->writeText(' <comment>' . $namespace['id'] . '</comment>', $options); |
|
250 | + $this->writeText(' <comment>'.$namespace['id'].'</comment>', $options); |
|
251 | 251 | } |
252 | 252 | |
253 | 253 | foreach ($namespace['commands'] as $name) { |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | |
51 | 51 | $that = $this; |
52 | 52 | |
53 | - $interviewer = function () use ($that) { |
|
53 | + $interviewer = function() use ($that) { |
|
54 | 54 | return $that->doAsk(); |
55 | 55 | }; |
56 | 56 | |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | protected function getHiddenResponse($inputStream) |
193 | 193 | { |
194 | 194 | if ('\\' === DIRECTORY_SEPARATOR) { |
195 | - $exe = __DIR__ . '/../bin/hiddeninput.exe'; |
|
195 | + $exe = __DIR__.'/../bin/hiddeninput.exe'; |
|
196 | 196 | |
197 | 197 | $value = rtrim(shell_exec($exe)); |
198 | 198 | $this->output->writeln(''); |
@@ -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 | |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | private $console; |
29 | 29 | private $name; |
30 | 30 | private $processTitle; |
31 | - private $aliases = []; |
|
31 | + private $aliases = []; |
|
32 | 32 | private $definition; |
33 | 33 | private $help; |
34 | 34 | private $description; |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | ]; |
405 | 405 | $replacements = [ |
406 | 406 | $name, |
407 | - $_SERVER['PHP_SELF'] . ' ' . $name, |
|
407 | + $_SERVER['PHP_SELF'].' '.$name, |
|
408 | 408 | ]; |
409 | 409 | |
410 | 410 | return str_replace($placeholders, $replacements, $this->getHelp()); |
@@ -356,11 +356,11 @@ |
||
356 | 356 | } |
357 | 357 | |
358 | 358 | foreach ($this->getArguments() as $argument) { |
359 | - $element = '<' . $argument->getName() . '>'; |
|
359 | + $element = '<'.$argument->getName().'>'; |
|
360 | 360 | if (!$argument->isRequired()) { |
361 | - $element = '[' . $element . ']'; |
|
361 | + $element = '['.$element.']'; |
|
362 | 362 | } elseif ($argument->isArray()) { |
363 | - $element .= ' (' . $element . ')'; |
|
363 | + $element .= ' ('.$element.')'; |
|
364 | 364 | } |
365 | 365 | |
366 | 366 | if ($argument->isArray()) { |