@@ -8,7 +8,7 @@ |
||
8 | 8 | // +---------------------------------------------------------------------- |
9 | 9 | // | Author: 麦当苗儿 <[email protected]> <http://zjzit.cn> |
10 | 10 | // +---------------------------------------------------------------------- |
11 | -declare (strict_types = 1); |
|
11 | +declare(strict_types=1); |
|
12 | 12 | |
13 | 13 | namespace think\initializer; |
14 | 14 |
@@ -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\initializer; |
14 | 14 |
@@ -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\initializer; |
14 | 14 | |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | |
32 | 32 | public function init(App $app) |
33 | 33 | { |
34 | - $file = $app->getRootPath() . 'runtime' . DIRECTORY_SEPARATOR . 'services.php'; |
|
34 | + $file = $app->getRootPath().'runtime'.DIRECTORY_SEPARATOR.'services.php'; |
|
35 | 35 | |
36 | 36 | $services = $this->services; |
37 | 37 |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | // +---------------------------------------------------------------------- |
7 | 7 | // | Author: zhangyajun <[email protected]> |
8 | 8 | // +---------------------------------------------------------------------- |
9 | -declare (strict_types = 1); |
|
9 | +declare(strict_types=1); |
|
10 | 10 | |
11 | 11 | namespace think; |
12 | 12 | |
@@ -469,10 +469,10 @@ discard block |
||
469 | 469 | public function findNamespace(string $namespace): string |
470 | 470 | { |
471 | 471 | $allNamespaces = $this->getNamespaces(); |
472 | - $expr = preg_replace_callback('{([^:]+|)}', function ($matches) { |
|
473 | - return preg_quote($matches[1]) . '[^:]*'; |
|
472 | + $expr = preg_replace_callback('{([^:]+|)}', function($matches) { |
|
473 | + return preg_quote($matches[1]).'[^:]*'; |
|
474 | 474 | }, $namespace); |
475 | - $namespaces = preg_grep('{^' . $expr . '}', $allNamespaces); |
|
475 | + $namespaces = preg_grep('{^'.$expr.'}', $allNamespaces); |
|
476 | 476 | |
477 | 477 | if (empty($namespaces)) { |
478 | 478 | $message = sprintf('There are no commands defined in the "%s" namespace.', $namespace); |
@@ -509,13 +509,13 @@ discard block |
||
509 | 509 | { |
510 | 510 | $allCommands = array_keys($this->commands); |
511 | 511 | |
512 | - $expr = preg_replace_callback('{([^:]+|)}', function ($matches) { |
|
513 | - return preg_quote($matches[1]) . '[^:]*'; |
|
512 | + $expr = preg_replace_callback('{([^:]+|)}', function($matches) { |
|
513 | + return preg_quote($matches[1]).'[^:]*'; |
|
514 | 514 | }, $name); |
515 | 515 | |
516 | - $commands = preg_grep('{^' . $expr . '}', $allCommands); |
|
516 | + $commands = preg_grep('{^'.$expr.'}', $allCommands); |
|
517 | 517 | |
518 | - if (empty($commands) || count(preg_grep('{^' . $expr . '$}', $commands)) < 1) { |
|
518 | + if (empty($commands) || count(preg_grep('{^'.$expr.'$}', $commands)) < 1) { |
|
519 | 519 | if (false !== $pos = strrpos($name, ':')) { |
520 | 520 | $this->findNamespace(substr($name, 0, $pos)); |
521 | 521 | } |
@@ -709,7 +709,7 @@ discard block |
||
709 | 709 | } |
710 | 710 | } |
711 | 711 | |
712 | - $alternatives = array_filter($alternatives, function ($lev) use ($threshold) { |
|
712 | + $alternatives = array_filter($alternatives, function($lev) use ($threshold) { |
|
713 | 713 | return $lev < 2 * $threshold; |
714 | 714 | }); |
715 | 715 | asort($alternatives); |
@@ -730,7 +730,7 @@ discard block |
||
730 | 730 | |
731 | 731 | foreach ($parts as $part) { |
732 | 732 | if (count($namespaces)) { |
733 | - $namespaces[] = end($namespaces) . ':' . $part; |
|
733 | + $namespaces[] = end($namespaces).':'.$part; |
|
734 | 734 | } else { |
735 | 735 | $namespaces[] = $part; |
736 | 736 | } |
@@ -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 | /** |