@@ -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 | |
@@ -78,14 +78,14 @@ discard block |
||
| 78 | 78 | |
| 79 | 79 | // 模板不存在 抛出异常 |
| 80 | 80 | if (!is_file($template)) { |
| 81 | - throw new RuntimeException('template not exists:' . $template); |
|
| 81 | + throw new RuntimeException('template not exists:'.$template); |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | $this->template = $template; |
| 85 | 85 | |
| 86 | 86 | // 记录视图信息 |
| 87 | 87 | $this->app->log |
| 88 | - ->record('[ VIEW ] ' . $template . ' [ ' . var_export(array_keys($data), true) . ' ]'); |
|
| 88 | + ->record('[ VIEW ] '.$template.' [ '.var_export(array_keys($data), true).' ]'); |
|
| 89 | 89 | |
| 90 | 90 | extract($data, EXTR_OVERWRITE); |
| 91 | 91 | |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | $this->content = $content; |
| 105 | 105 | |
| 106 | 106 | extract($data, EXTR_OVERWRITE); |
| 107 | - eval('?>' . $this->content); |
|
| 107 | + eval('?>'.$this->content); |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | /** |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | private function parseTemplate(string $template): string |
| 117 | 117 | { |
| 118 | 118 | if (empty($this->config['view_base'])) { |
| 119 | - $this->config['view_base'] = $this->app->getRootPath() . 'view' . DIRECTORY_SEPARATOR; |
|
| 119 | + $this->config['view_base'] = $this->app->getRootPath().'view'.DIRECTORY_SEPARATOR; |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | $request = $this->app->request; |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | } else { |
| 133 | 133 | $app = isset($app) ? $app : $request->app(); |
| 134 | 134 | // 基础视图目录 |
| 135 | - $path = $this->config['view_base'] . ($app ? $app . DIRECTORY_SEPARATOR : ''); |
|
| 135 | + $path = $this->config['view_base'].($app ? $app.DIRECTORY_SEPARATOR : ''); |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | $depr = $this->config['view_depr']; |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | $controller = $request->controller(); |
| 143 | 143 | if (strpos($controller, '.')) { |
| 144 | 144 | $pos = strrpos($controller, '.'); |
| 145 | - $controller = substr($controller, 0, $pos) . '.' . Str::snake(substr($controller, $pos + 1)); |
|
| 145 | + $controller = substr($controller, 0, $pos).'.'.Str::snake(substr($controller, $pos + 1)); |
|
| 146 | 146 | } else { |
| 147 | 147 | $controller = Str::snake($controller); |
| 148 | 148 | } |
@@ -158,16 +158,16 @@ discard block |
||
| 158 | 158 | $template = Str::snake($request->action()); |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | - $template = str_replace('.', DIRECTORY_SEPARATOR, $controller) . $depr . $template; |
|
| 161 | + $template = str_replace('.', DIRECTORY_SEPARATOR, $controller).$depr.$template; |
|
| 162 | 162 | } elseif (false === strpos($template, $depr)) { |
| 163 | - $template = str_replace('.', DIRECTORY_SEPARATOR, $controller) . $depr . $template; |
|
| 163 | + $template = str_replace('.', DIRECTORY_SEPARATOR, $controller).$depr.$template; |
|
| 164 | 164 | } |
| 165 | 165 | } |
| 166 | 166 | } else { |
| 167 | 167 | $template = str_replace(['/', ':'], $depr, substr($template, 1)); |
| 168 | 168 | } |
| 169 | 169 | |
| 170 | - return $path . ltrim($template, '/') . '.' . ltrim($this->config['view_suffix'], '.'); |
|
| 170 | + return $path.ltrim($template, '/').'.'.ltrim($this->config['view_suffix'], '.'); |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | /** |