Passed
Push — 5.1 ( 4abe34...5f0d26 )
by liu
17:41 queued 03:58
created
library/think/Url.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -42,9 +42,9 @@  discard block
 block discarded – undo
42 42
         $this->app    = $app;
43 43
         $this->config = $config;
44 44
 
45
-        if (is_file($app->getRuntimePath() . 'route.php')) {
45
+        if (is_file($app->getRuntimePath().'route.php')) {
46 46
             // 读取路由映射文件
47
-            $app['route']->setName(include $app->getRuntimePath() . 'route.php');
47
+            $app['route']->setName(include $app->getRuntimePath().'route.php');
48 48
         }
49 49
     }
50 50
 
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
         if (0 === strpos($url, '[') && $pos = strpos($url, ']')) {
80 80
             // [name] 表示使用路由命名标识生成URL
81 81
             $name = substr($url, 1, $pos - 1);
82
-            $url  = 'name' . substr($url, $pos + 1);
82
+            $url  = 'name'.substr($url, $pos + 1);
83 83
         }
84 84
 
85 85
         if (false === strpos($url, '://') && 0 !== strpos($url, '/')) {
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
         }
113 113
 
114 114
         if ($url) {
115
-            $checkName   = isset($name) ? $name : $url . (isset($info['query']) ? '?' . $info['query'] : '');
115
+            $checkName   = isset($name) ? $name : $url.(isset($info['query']) ? '?'.$info['query'] : '');
116 116
             $checkDomain = $domain && is_string($domain) ? $domain : null;
117 117
 
118 118
             $rule = $this->app['route']->getName($checkName, $checkDomain);
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
                 $suffix = $match[2];
139 139
             }
140 140
         } elseif (!empty($rule) && isset($name)) {
141
-            throw new \InvalidArgumentException('route name not exists:' . $name);
141
+            throw new \InvalidArgumentException('route name not exists:'.$name);
142 142
         } else {
143 143
             // 检查别名路由
144 144
             $alias      = $this->app['route']->getAlias();
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
                     $val = $item->getRoute();
151 151
 
152 152
                     if (0 === strpos($url, $val)) {
153
-                        $url        = $key . substr($url, strlen($val));
153
+                        $url        = $key.substr($url, strlen($val));
154 154
                         $matchAlias = true;
155 155
                         break;
156 156
                     }
@@ -200,38 +200,38 @@  discard block
 block discarded – undo
200 200
         }
201 201
 
202 202
         // 锚点
203
-        $anchor = !empty($anchor) ? '#' . $anchor : '';
203
+        $anchor = !empty($anchor) ? '#'.$anchor : '';
204 204
 
205 205
         // 参数组装
206 206
         if (!empty($vars)) {
207 207
             // 添加参数
208 208
             if ($this->config['url_common_param']) {
209 209
                 $vars = http_build_query($vars);
210
-                $url .= $suffix . '?' . $vars . $anchor;
210
+                $url .= $suffix.'?'.$vars.$anchor;
211 211
             } else {
212 212
                 $paramType = $this->config['url_param_type'];
213 213
 
214 214
                 foreach ($vars as $var => $val) {
215 215
                     if ('' !== trim($val)) {
216 216
                         if ($paramType) {
217
-                            $url .= $depr . urlencode($val);
217
+                            $url .= $depr.urlencode($val);
218 218
                         } else {
219
-                            $url .= $depr . $var . $depr . urlencode($val);
219
+                            $url .= $depr.$var.$depr.urlencode($val);
220 220
                         }
221 221
                     }
222 222
                 }
223 223
 
224
-                $url .= $suffix . $anchor;
224
+                $url .= $suffix.$anchor;
225 225
             }
226 226
         } else {
227
-            $url .= $suffix . $anchor;
227
+            $url .= $suffix.$anchor;
228 228
         }
229 229
 
230 230
         // 检测域名
231 231
         $domain = $this->parseDomain($url, $domain);
232 232
 
233 233
         // URL组装
234
-        $url = $domain . rtrim($this->root ?: $this->app['request']->root(), '/') . '/' . ltrim($url, '/');
234
+        $url = $domain.rtrim($this->root ?: $this->app['request']->root(), '/').'/'.ltrim($url, '/');
235 235
 
236 236
         $this->bindCheck = false;
237 237
 
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
         } else {
256 256
             // 解析到 模块/控制器/操作
257 257
             $module     = $request->module();
258
-            $module     = $module ? $module . '/' : '';
258
+            $module     = $module ? $module.'/' : '';
259 259
             $controller = $request->controller();
260 260
 
261 261
             if ('' == $url) {
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
                 $path       = explode('/', $url);
265 265
                 $action     = array_pop($path);
266 266
                 $controller = empty($path) ? $controller : array_pop($path);
267
-                $module     = empty($path) ? $module : array_pop($path) . '/';
267
+                $module     = empty($path) ? $module : array_pop($path).'/';
268 268
             }
269 269
 
270 270
             if ($this->config['url_convert']) {
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
                 $controller = Loader::parseName($controller);
273 273
             }
274 274
 
275
-            $url = $module . $controller . '/' . $action;
275
+            $url = $module.$controller.'/'.$action;
276 276
         }
277 277
 
278 278
         return $url;
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
                 }
320 320
             }
321 321
         } elseif (0 !== strpos($domain, $rootDomain) && false === strpos($domain, '.')) {
322
-            $domain .= '.' . $rootDomain;
322
+            $domain .= '.'.$rootDomain;
323 323
         }
324 324
 
325 325
         if (false !== strpos($domain, '://')) {
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
 
330 330
         }
331 331
 
332
-        return $scheme . $domain;
332
+        return $scheme.$domain;
333 333
     }
334 334
 
335 335
     // 解析URL后缀
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
             }
344 344
         }
345 345
 
346
-        return (empty($suffix) || 0 === strpos($suffix, '.')) ? $suffix : '.' . $suffix;
346
+        return (empty($suffix) || 0 === strpos($suffix, '.')) ? $suffix : '.'.$suffix;
347 347
     }
348 348
 
349 349
     // 匹配路由地址
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
             }
358 358
 
359 359
             if (!in_array($this->app['request']->port(), [80, 443])) {
360
-                $domain .= ':' . $this->app['request']->port();
360
+                $domain .= ':'.$this->app['request']->port();
361 361
             }
362 362
 
363 363
             if (empty($pattern)) {
@@ -368,12 +368,12 @@  discard block
 block discarded – undo
368 368
 
369 369
             foreach ($pattern as $key => $val) {
370 370
                 if (isset($vars[$key])) {
371
-                    $url = str_replace(['[:' . $key . ']', '<' . $key . '?>', ':' . $key, '<' . $key . '>'], $type ? $vars[$key] : urlencode($vars[$key]), $url);
371
+                    $url = str_replace(['[:'.$key.']', '<'.$key.'?>', ':'.$key, '<'.$key.'>'], $type ? $vars[$key] : urlencode($vars[$key]), $url);
372 372
                     unset($vars[$key]);
373 373
                     $url    = str_replace(['/?', '-?'], ['/', '-'], $url);
374 374
                     $result = [rtrim($url, '?/-'), $domain, $suffix];
375 375
                 } elseif (2 == $val) {
376
-                    $url    = str_replace(['/[:' . $key . ']', '[:' . $key . ']', '<' . $key . '?>'], '', $url);
376
+                    $url    = str_replace(['/[:'.$key.']', '[:'.$key.']', '<'.$key.'?>'], '', $url);
377 377
                     $url    = str_replace(['/?', '-?'], ['/', '-'], $url);
378 378
                     $result = [rtrim($url, '?/-'), $domain, $suffix];
379 379
                 } else {
Please login to merge, or discard this patch.
library/think/Controller.php 1 patch
Spacing   +5 added lines, -6 removed lines patch added patch discarded remove patch
@@ -72,8 +72,7 @@  discard block
 block discarded – undo
72 72
         // 前置操作方法 即将废弃
73 73
         foreach ((array) $this->beforeActionList as $method => $options) {
74 74
             is_numeric($method) ?
75
-            $this->beforeAction($options) :
76
-            $this->beforeAction($method, $options);
75
+            $this->beforeAction($options) : $this->beforeAction($method, $options);
77 76
         }
78 77
     }
79 78
 
@@ -89,11 +88,11 @@  discard block
 block discarded – undo
89 88
                 $only = $except = null;
90 89
 
91 90
                 if (isset($val['only'])) {
92
-                    $only = array_map(function ($item) {
91
+                    $only = array_map(function($item) {
93 92
                         return strtolower($item);
94 93
                     }, $val['only']);
95 94
                 } elseif (isset($val['except'])) {
96
-                    $except = array_map(function ($item) {
95
+                    $except = array_map(function($item) {
97 96
                         return strtolower($item);
98 97
                     }, $val['except']);
99 98
                 }
@@ -124,7 +123,7 @@  discard block
 block discarded – undo
124 123
                 $options['only'] = explode(',', $options['only']);
125 124
             }
126 125
 
127
-            $only = array_map(function ($val) {
126
+            $only = array_map(function($val) {
128 127
                 return strtolower($val);
129 128
             }, $options['only']);
130 129
 
@@ -136,7 +135,7 @@  discard block
 block discarded – undo
136 135
                 $options['except'] = explode(',', $options['except']);
137 136
             }
138 137
 
139
-            $except = array_map(function ($val) {
138
+            $except = array_map(function($val) {
140 139
                 return strtolower($val);
141 140
             }, $options['except']);
142 141
 
Please login to merge, or discard this patch.
library/think/view/driver/Think.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
         $this->config = array_merge($this->config, (array) $config);
45 45
 
46 46
         if (empty($this->config['view_path'])) {
47
-            $this->config['view_path'] = $app->getModulePath() . 'view' . DIRECTORY_SEPARATOR;
47
+            $this->config['view_path'] = $app->getModulePath().'view'.DIRECTORY_SEPARATOR;
48 48
         }
49 49
 
50 50
         $this->template = new Template($app, $this->config);
@@ -83,12 +83,12 @@  discard block
 block discarded – undo
83 83
 
84 84
         // 模板不存在 抛出异常
85 85
         if (!is_file($template)) {
86
-            throw new TemplateNotFoundException('template not exists:' . $template, $template);
86
+            throw new TemplateNotFoundException('template not exists:'.$template, $template);
87 87
         }
88 88
 
89 89
         // 记录视图信息
90 90
         $this->app
91
-            ->log('[ VIEW ] ' . $template . ' [ ' . var_export(array_keys($data), true) . ' ]');
91
+            ->log('[ VIEW ] '.$template.' [ '.var_export(array_keys($data), true).' ]');
92 92
 
93 93
         $this->template->fetch($template, $data, $config);
94 94
     }
@@ -126,9 +126,9 @@  discard block
 block discarded – undo
126 126
         if ($this->config['view_base']) {
127 127
             // 基础视图目录
128 128
             $module = isset($module) ? $module : $request->module();
129
-            $path   = $this->config['view_base'] . ($module ? $module . DIRECTORY_SEPARATOR : '');
129
+            $path   = $this->config['view_base'].($module ? $module.DIRECTORY_SEPARATOR : '');
130 130
         } else {
131
-            $path = isset($module) ? $this->app->getAppPath() . $module . DIRECTORY_SEPARATOR . 'view' . DIRECTORY_SEPARATOR : $this->config['view_path'];
131
+            $path = isset($module) ? $this->app->getAppPath().$module.DIRECTORY_SEPARATOR.'view'.DIRECTORY_SEPARATOR : $this->config['view_path'];
132 132
         }
133 133
 
134 134
         $depr = $this->config['view_depr'];
@@ -140,16 +140,16 @@  discard block
 block discarded – undo
140 140
             if ($controller) {
141 141
                 if ('' == $template) {
142 142
                     // 如果模板文件名为空 按照默认规则定位
143
-                    $template = str_replace('.', DIRECTORY_SEPARATOR, $controller) . $depr . $this->getActionTemplate($request);
143
+                    $template = str_replace('.', DIRECTORY_SEPARATOR, $controller).$depr.$this->getActionTemplate($request);
144 144
                 } elseif (false === strpos($template, $depr)) {
145
-                    $template = str_replace('.', DIRECTORY_SEPARATOR, $controller) . $depr . $template;
145
+                    $template = str_replace('.', DIRECTORY_SEPARATOR, $controller).$depr.$template;
146 146
                 }
147 147
             }
148 148
         } else {
149 149
             $template = str_replace(['/', ':'], $depr, substr($template, 1));
150 150
         }
151 151
 
152
-        return $path . ltrim($template, '/') . '.' . ltrim($this->config['view_suffix'], '.');
152
+        return $path.ltrim($template, '/').'.'.ltrim($this->config['view_suffix'], '.');
153 153
     }
154 154
 
155 155
     protected function getActionTemplate($request)
Please login to merge, or discard this patch.
library/think/view/driver/Php.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -73,14 +73,14 @@  discard block
 block discarded – undo
73 73
 
74 74
         // 模板不存在 抛出异常
75 75
         if (!is_file($template)) {
76
-            throw new TemplateNotFoundException('template not exists:' . $template, $template);
76
+            throw new TemplateNotFoundException('template not exists:'.$template, $template);
77 77
         }
78 78
 
79 79
         $this->template = $template;
80 80
 
81 81
         // 记录视图信息
82 82
         $this->app
83
-            ->log('[ VIEW ] ' . $template . ' [ ' . var_export(array_keys($data), true) . ' ]');
83
+            ->log('[ VIEW ] '.$template.' [ '.var_export(array_keys($data), true).' ]');
84 84
 
85 85
         extract($data, EXTR_OVERWRITE);
86 86
         include $this->template;
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
         $this->content = $content;
99 99
 
100 100
         extract($data, EXTR_OVERWRITE);
101
-        eval('?>' . $this->content);
101
+        eval('?>'.$this->content);
102 102
     }
103 103
 
104 104
     /**
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
     private function parseTemplate($template)
111 111
     {
112 112
         if (empty($this->config['view_path'])) {
113
-            $this->config['view_path'] = $this->app->getModulePath() . 'view' . DIRECTORY_SEPARATOR;
113
+            $this->config['view_path'] = $this->app->getModulePath().'view'.DIRECTORY_SEPARATOR;
114 114
         }
115 115
 
116 116
         $request = $this->app['request'];
@@ -124,9 +124,9 @@  discard block
 block discarded – undo
124 124
         if ($this->config['view_base']) {
125 125
             // 基础视图目录
126 126
             $module = isset($module) ? $module : $request->module();
127
-            $path   = $this->config['view_base'] . ($module ? $module . DIRECTORY_SEPARATOR : '');
127
+            $path   = $this->config['view_base'].($module ? $module.DIRECTORY_SEPARATOR : '');
128 128
         } else {
129
-            $path = isset($module) ? $this->app->getAppPath() . $module . DIRECTORY_SEPARATOR . 'view' . DIRECTORY_SEPARATOR : $this->config['view_path'];
129
+            $path = isset($module) ? $this->app->getAppPath().$module.DIRECTORY_SEPARATOR.'view'.DIRECTORY_SEPARATOR : $this->config['view_path'];
130 130
         }
131 131
 
132 132
         $depr = $this->config['view_depr'];
@@ -138,16 +138,16 @@  discard block
 block discarded – undo
138 138
             if ($controller) {
139 139
                 if ('' == $template) {
140 140
                     // 如果模板文件名为空 按照默认规则定位
141
-                    $template = str_replace('.', DIRECTORY_SEPARATOR, $controller) . $depr . $this->getActionTemplate($request);
141
+                    $template = str_replace('.', DIRECTORY_SEPARATOR, $controller).$depr.$this->getActionTemplate($request);
142 142
                 } elseif (false === strpos($template, $depr)) {
143
-                    $template = str_replace('.', DIRECTORY_SEPARATOR, $controller) . $depr . $template;
143
+                    $template = str_replace('.', DIRECTORY_SEPARATOR, $controller).$depr.$template;
144 144
                 }
145 145
             }
146 146
         } else {
147 147
             $template = str_replace(['/', ':'], $depr, substr($template, 1));
148 148
         }
149 149
 
150
-        return $path . ltrim($template, '/') . '.' . ltrim($this->config['view_suffix'], '.');
150
+        return $path.ltrim($template, '/').'.'.ltrim($this->config['view_suffix'], '.');
151 151
     }
152 152
 
153 153
     protected function getActionTemplate($request)
Please login to merge, or discard this patch.
library/think/Hook.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -202,7 +202,7 @@
 block discarded – undo
202 202
             }
203 203
 
204 204
             $call  = [$class, $method];
205
-            $class = $class . '->' . $method;
205
+            $class = $class.'->'.$method;
206 206
         }
207 207
 
208 208
         $result = $this->app->invoke($call, [$params]);
Please login to merge, or discard this patch.
helper.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -483,7 +483,7 @@  discard block
 block discarded – undo
483 483
     function parse_name($name, $type = 0, $ucfirst = true)
484 484
     {
485 485
         if ($type) {
486
-            $name = preg_replace_callback('/_([a-zA-Z])/', function ($match) {
486
+            $name = preg_replace_callback('/_([a-zA-Z])/', function($match) {
487 487
                 return strtoupper($match[1]);
488 488
             }, $name);
489 489
 
@@ -594,7 +594,7 @@  discard block
 block discarded – undo
594 594
     {
595 595
         $token = Request::token($name, $type);
596 596
 
597
-        return '<input type="hidden" name="' . $name . '" value="' . $token . '" />';
597
+        return '<input type="hidden" name="'.$name.'" value="'.$token.'" />';
598 598
     }
599 599
 }
600 600
 
Please login to merge, or discard this patch.
library/think/process/exception/Failed.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
             throw new \InvalidArgumentException('Expected a failed process, but the given process was successful.');
25 25
         }
26 26
 
27
-        $error = sprintf('The command "%s" failed.' . "\nExit Code: %s(%s)", $process->getCommandLine(), $process->getExitCode(), $process->getExitCodeText());
27
+        $error = sprintf('The command "%s" failed.'."\nExit Code: %s(%s)", $process->getCommandLine(), $process->getExitCode(), $process->getExitCodeText());
28 28
 
29 29
         if (!$process->isOutputDisabled()) {
30 30
             $error .= sprintf("\n\nOutput:\n================\n%s\n\nError Output:\n================\n%s", $process->getOutput(), $process->getErrorOutput());
Please login to merge, or discard this patch.