@@ -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 | |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | |
| 92 | 92 | // 模板不存在 抛出异常 |
| 93 | 93 | if (!is_file($template)) { |
| 94 | - throw new TemplateNotFoundException('template not exists:' . $template, $template); |
|
| 94 | + throw new TemplateNotFoundException('template not exists:'.$template, $template); |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | $this->template = $template; |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | |
| 101 | 101 | // 记录视图信息 |
| 102 | 102 | $this->app->log |
| 103 | - ->record('[ VIEW ] ' . $template . ' [ ' . var_export(array_keys($data), true) . ' ]'); |
|
| 103 | + ->record('[ VIEW ] '.$template.' [ '.var_export(array_keys($data), true).' ]'); |
|
| 104 | 104 | |
| 105 | 105 | extract($data, EXTR_OVERWRITE); |
| 106 | 106 | |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | $data = array_merge($this->vars, $data); |
| 122 | 122 | |
| 123 | 123 | extract($data, EXTR_OVERWRITE); |
| 124 | - eval('?>' . $this->content); |
|
| 124 | + eval('?>'.$this->content); |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | /** |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | private function parseTemplate(string $template): string |
| 134 | 134 | { |
| 135 | 135 | if (empty($this->config['view_base'])) { |
| 136 | - $this->config['view_base'] = $this->app->getRootPath() . 'view' . DIRECTORY_SEPARATOR; |
|
| 136 | + $this->config['view_base'] = $this->app->getRootPath().'view'.DIRECTORY_SEPARATOR; |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | $request = $this->app->request; |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | } else { |
| 150 | 150 | $app = isset($app) ? $app : $request->app(); |
| 151 | 151 | // 基础视图目录 |
| 152 | - $path = $this->config['view_base'] . ($app ? $app . DIRECTORY_SEPARATOR : ''); |
|
| 152 | + $path = $this->config['view_base'].($app ? $app.DIRECTORY_SEPARATOR : ''); |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | $depr = $this->config['view_depr']; |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | $controller = $request->controller(); |
| 160 | 160 | if (strpos($controller, '.')) { |
| 161 | 161 | $pos = strrpos($controller, '.'); |
| 162 | - $controller = substr($controller, 0, $pos) . '.' . Str::snake(substr($controller, $pos + 1)); |
|
| 162 | + $controller = substr($controller, 0, $pos).'.'.Str::snake(substr($controller, $pos + 1)); |
|
| 163 | 163 | } else { |
| 164 | 164 | $controller = Str::snake($controller); |
| 165 | 165 | } |
@@ -175,16 +175,16 @@ discard block |
||
| 175 | 175 | $template = Str::snake($request->action()); |
| 176 | 176 | } |
| 177 | 177 | |
| 178 | - $template = str_replace('.', DIRECTORY_SEPARATOR, $controller) . $depr . $template; |
|
| 178 | + $template = str_replace('.', DIRECTORY_SEPARATOR, $controller).$depr.$template; |
|
| 179 | 179 | } elseif (false === strpos($template, $depr)) { |
| 180 | - $template = str_replace('.', DIRECTORY_SEPARATOR, $controller) . $depr . $template; |
|
| 180 | + $template = str_replace('.', DIRECTORY_SEPARATOR, $controller).$depr.$template; |
|
| 181 | 181 | } |
| 182 | 182 | } |
| 183 | 183 | } else { |
| 184 | 184 | $template = str_replace(['/', ':'], $depr, substr($template, 1)); |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | - return $path . ltrim($template, '/') . '.' . ltrim($this->config['view_suffix'], '.'); |
|
| 187 | + return $path.ltrim($template, '/').'.'.ltrim($this->config['view_suffix'], '.'); |
|
| 188 | 188 | } |
| 189 | 189 | |
| 190 | 190 | /** |