Passed
Pull Request — 5.1 (#2217)
by
unknown
13:33
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
     // 匹配路由地址
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
             }
359 359
 
360 360
             if ($port && !in_array($port, [80, 443])) {
361
-                $domain .= ':' . $port;
361
+                $domain .= ':'.$port;
362 362
             }
363 363
 
364 364
             if (empty($pattern)) {
@@ -370,12 +370,12 @@  discard block
 block discarded – undo
370 370
 
371 371
             foreach ($pattern as $key => $val) {
372 372
                 if (isset($vars[$key])) {
373
-                    $url    = str_replace(['[:' . $key . ']', '<' . $key . '?>', ':' . $key, '<' . $key . '>'], $type ? $vars[$key] : urlencode($vars[$key]), $url);
373
+                    $url    = str_replace(['[:'.$key.']', '<'.$key.'?>', ':'.$key, '<'.$key.'>'], $type ? $vars[$key] : urlencode($vars[$key]), $url);
374 374
                     $keys[] = $key;
375 375
                     $url    = str_replace(['/?', '-?'], ['/', '-'], $url);
376 376
                     $result = [rtrim($url, '?/-'), $domain, $suffix];
377 377
                 } elseif (2 == $val) {
378
-                    $url    = str_replace(['/[:' . $key . ']', '[:' . $key . ']', '<' . $key . '?>'], '', $url);
378
+                    $url    = str_replace(['/[:'.$key.']', '[:'.$key.']', '<'.$key.'?>'], '', $url);
379 379
                     $url    = str_replace(['/?', '-?'], ['/', '-'], $url);
380 380
                     $result = [rtrim($url, '?/-'), $domain, $suffix];
381 381
                 } else {
Please login to merge, or discard this patch.
library/think/route/dispatch/Url.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
         if (!empty($bind) && preg_match('/^[a-z]/is', $bind)) {
43 43
             $bind = str_replace('/', $depr, $bind);
44 44
             // 如果有模块/控制器绑定
45
-            $url = $bind . ('.' != substr($bind, -1) ? $depr : '') . ltrim($url, $depr);
45
+            $url = $bind.('.' != substr($bind, -1) ? $depr : '').ltrim($url, $depr);
46 46
         }
47 47
 
48 48
         list($path, $var) = $this->rule->parseUrlPath($url);
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
         }
62 62
 
63 63
         if ($controller && !preg_match('/^[A-Za-z0-9][\w|\.]*$/', $controller)) {
64
-            throw new HttpException(404, 'controller not exists:' . $controller);
64
+            throw new HttpException(404, 'controller not exists:'.$controller);
65 65
         }
66 66
 
67 67
         // 解析操作
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
             if ($this->rule->getConfig('url_param_type')) {
73 73
                 $var += $path;
74 74
             } else {
75
-                preg_replace_callback('/(\w+)\|([^\|]+)/', function ($match) use (&$var) {
75
+                preg_replace_callback('/(\w+)\|([^\|]+)/', function($match) use (&$var) {
76 76
                     $var[$match[1]] = strip_tags($match[2]);
77 77
                 }, implode('|', $path));
78 78
             }
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
         $route = [$module, $controller, $action];
93 93
 
94 94
         if ($this->hasDefinedRoute($route, $bind)) {
95
-            throw new HttpException(404, 'invalid request:' . str_replace('|', $depr, $url));
95
+            throw new HttpException(404, 'invalid request:'.str_replace('|', $depr, $url));
96 96
         }
97 97
 
98 98
         return $route;
@@ -110,12 +110,12 @@  discard block
 block discarded – undo
110 110
         list($module, $controller, $action) = $route;
111 111
 
112 112
         // 检查地址是否被定义过路由
113
-        $name = strtolower($module . '/' . Loader::parseName($controller, 1) . '/' . $action);
113
+        $name = strtolower($module.'/'.Loader::parseName($controller, 1).'/'.$action);
114 114
 
115 115
         $name2 = '';
116 116
 
117 117
         if (empty($module) || $module == $bind) {
118
-            $name2 = strtolower(Loader::parseName($controller, 1) . '/' . $action);
118
+            $name2 = strtolower(Loader::parseName($controller, 1).'/'.$action);
119 119
         }
120 120
 
121 121
         $host = $this->request->host(true);
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
      */
139 139
     protected function autoFindController($module, &$path)
140 140
     {
141
-        $dir    = $this->app->getAppPath() . ($module ? $module . '/' : '') . $this->rule->getConfig('url_controller_layer');
141
+        $dir    = $this->app->getAppPath().($module ? $module.'/' : '').$this->rule->getConfig('url_controller_layer');
142 142
         $suffix = $this->app->getSuffix() || $this->rule->getConfig('controller_suffix') ? ucfirst($this->rule->getConfig('url_controller_layer')) : '';
143 143
 
144 144
         $item = [];
@@ -146,13 +146,13 @@  discard block
 block discarded – undo
146 146
 
147 147
         foreach ($path as $val) {
148 148
             $item[] = $val;
149
-            $file   = $dir . '/' . str_replace('.', '/', $val) . $suffix . '.php';
150
-            $file   = pathinfo($file, PATHINFO_DIRNAME) . '/' . Loader::parseName(pathinfo($file, PATHINFO_FILENAME), 1) . '.php';
149
+            $file   = $dir.'/'.str_replace('.', '/', $val).$suffix.'.php';
150
+            $file   = pathinfo($file, PATHINFO_DIRNAME).'/'.Loader::parseName(pathinfo($file, PATHINFO_FILENAME), 1).'.php';
151 151
             if (is_file($file)) {
152 152
                 $find = true;
153 153
                 break;
154 154
             } else {
155
-                $dir .= '/' . Loader::parseName($val);
155
+                $dir .= '/'.Loader::parseName($val);
156 156
             }
157 157
         }
158 158
 
Please login to merge, or discard this patch.
library/think/db/Query.php 1 patch
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -189,15 +189,15 @@  discard block
 block discarded – undo
189 189
             $name = Loader::parseName(substr($method, 5));
190 190
             array_unshift($args, $name);
191 191
             return call_user_func_array([$this, 'where'], $args);
192
-        } elseif ($this->model && method_exists($this->model, 'scope' . $method)) {
192
+        } elseif ($this->model && method_exists($this->model, 'scope'.$method)) {
193 193
             // 动态调用命名范围
194
-            $method = 'scope' . $method;
194
+            $method = 'scope'.$method;
195 195
             array_unshift($args, $this);
196 196
 
197 197
             call_user_func_array([$this->model, $method], $args);
198 198
             return $this;
199 199
         } else {
200
-            throw new Exception('method not exist:' . ($this->model ? get_class($this->model) : static::class) . '->' . $method);
200
+            throw new Exception('method not exist:'.($this->model ? get_class($this->model) : static::class).'->'.$method);
201 201
         }
202 202
     }
203 203
 
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
 
317 317
         $name = $name ?: $this->name;
318 318
 
319
-        return $this->prefix . Loader::parseName($name);
319
+        return $this->prefix.Loader::parseName($name);
320 320
     }
321 321
 
322 322
     /**
@@ -588,16 +588,16 @@  discard block
 block discarded – undo
588 588
                     $seq = (ord(substr($value, 0, 1)) % $rule['num']) + 1;
589 589
             }
590 590
 
591
-            return $this->getTable() . '_' . $seq;
591
+            return $this->getTable().'_'.$seq;
592 592
         }
593 593
         // 当设置的分表字段不在查询条件或者数据中
594 594
         // 进行联合查询,必须设定 partition['num']
595 595
         $tableName = [];
596 596
         for ($i = 0; $i < $rule['num']; $i++) {
597
-            $tableName[] = 'SELECT * FROM ' . $this->getTable() . '_' . ($i + 1);
597
+            $tableName[] = 'SELECT * FROM '.$this->getTable().'_'.($i + 1);
598 598
         }
599 599
 
600
-        return ['( ' . implode(" UNION ", $tableName) . ' )' => $this->name];
600
+        return ['( '.implode(" UNION ", $tableName).' )' => $this->name];
601 601
     }
602 602
 
603 603
     /**
@@ -663,7 +663,7 @@  discard block
 block discarded – undo
663 663
             // 支持GROUP
664 664
             $options = $this->getOptions();
665 665
             $subSql  = $this->options($options)
666
-                ->field('count(' . $field . ') AS think_count')
666
+                ->field('count('.$field.') AS think_count')
667 667
                 ->bind($this->bind)
668 668
                 ->buildSql();
669 669
 
@@ -766,7 +766,7 @@  discard block
 block discarded – undo
766 766
 
767 767
         if ($lazyTime > 0) {
768 768
             // 延迟写入
769
-            $guid = md5($this->getTable() . '_' . $field . '_' . serialize($condition));
769
+            $guid = md5($this->getTable().'_'.$field.'_'.serialize($condition));
770 770
             $step = $this->lazyWrite('inc', $guid, $step, $lazyTime);
771 771
 
772 772
             if (false === $step) {
@@ -799,7 +799,7 @@  discard block
 block discarded – undo
799 799
 
800 800
         if ($lazyTime > 0) {
801 801
             // 延迟写入
802
-            $guid = md5($this->getTable() . '_' . $field . '_' . serialize($condition));
802
+            $guid = md5($this->getTable().'_'.$field.'_'.serialize($condition));
803 803
             $step = $this->lazyWrite('dec', $guid, $step, $lazyTime);
804 804
 
805 805
             if (false === $step) {
@@ -830,15 +830,15 @@  discard block
 block discarded – undo
830 830
     {
831 831
         $cache = Container::get('cache');
832 832
 
833
-        if (!$cache->has($guid . '_time')) {
833
+        if (!$cache->has($guid.'_time')) {
834 834
             // 计时开始
835
-            $cache->set($guid . '_time', time(), 0);
835
+            $cache->set($guid.'_time', time(), 0);
836 836
             $cache->$type($guid, $step);
837
-        } elseif (time() > $cache->get($guid . '_time') + $lazyTime) {
837
+        } elseif (time() > $cache->get($guid.'_time') + $lazyTime) {
838 838
             // 删除缓存
839 839
             $value = $cache->$type($guid, $step);
840 840
             $cache->rm($guid);
841
-            $cache->rm($guid . '_time');
841
+            $cache->rm($guid.'_time');
842 842
             return 0 === $value ? false : $value;
843 843
         } else {
844 844
             // 更新缓存
@@ -1037,10 +1037,10 @@  discard block
 block discarded – undo
1037 1037
             $prefix = $prefix ?: $tableName;
1038 1038
             foreach ($field as $key => &$val) {
1039 1039
                 if (is_numeric($key) && $alias) {
1040
-                    $field[$prefix . '.' . $val] = $alias . $val;
1040
+                    $field[$prefix.'.'.$val] = $alias.$val;
1041 1041
                     unset($field[$key]);
1042 1042
                 } elseif (is_numeric($key)) {
1043
-                    $val = $prefix . '.' . $val;
1043
+                    $val = $prefix.'.'.$val;
1044 1044
                 }
1045 1045
             }
1046 1046
         }
@@ -1167,7 +1167,7 @@  discard block
 block discarded – undo
1167 1167
             $table  = $this->getJoinTable($join, $alias);
1168 1168
 
1169 1169
             if (true === $field) {
1170
-                $fields = $alias . '.*';
1170
+                $fields = $alias.'.*';
1171 1171
             } else {
1172 1172
                 if (is_string($field)) {
1173 1173
                     $field = explode(',', $field);
@@ -1175,17 +1175,17 @@  discard block
 block discarded – undo
1175 1175
 
1176 1176
                 foreach ($field as $key => $val) {
1177 1177
                     if (is_numeric($key)) {
1178
-                        $fields[] = $alias . '.' . $val;
1178
+                        $fields[] = $alias.'.'.$val;
1179 1179
 
1180
-                        $this->options['map'][$val] = $alias . '.' . $val;
1180
+                        $this->options['map'][$val] = $alias.'.'.$val;
1181 1181
                     } else {
1182 1182
                         if (preg_match('/[,=\.\'\"\(\s]/', $key)) {
1183 1183
                             $name = $key;
1184 1184
                         } else {
1185
-                            $name = $alias . '.' . $key;
1185
+                            $name = $alias.'.'.$key;
1186 1186
                         }
1187 1187
 
1188
-                        $fields[] = $name . ' AS ' . $val;
1188
+                        $fields[] = $name.' AS '.$val;
1189 1189
 
1190 1190
                         $this->options['map'][$val] = $name;
1191 1191
                     }
@@ -1498,9 +1498,9 @@  discard block
 block discarded – undo
1498 1498
             }
1499 1499
 
1500 1500
             if (is_numeric($key)) {
1501
-                $sql = substr_replace($sql, ':' . $name, strpos($sql, '?'), 1);
1501
+                $sql = substr_replace($sql, ':'.$name, strpos($sql, '?'), 1);
1502 1502
             } else {
1503
-                $sql = str_replace(':' . $key, ':' . $name, $sql);
1503
+                $sql = str_replace(':'.$key, ':'.$name, $sql);
1504 1504
             }
1505 1505
         }
1506 1506
     }
@@ -1544,7 +1544,7 @@  discard block
 block discarded – undo
1544 1544
         }
1545 1545
 
1546 1546
         if (is_string($field) && !empty($this->options['via']) && false === strpos($field, '.')) {
1547
-            $field = $this->options['via'] . '.' . $field;
1547
+            $field = $this->options['via'].'.'.$field;
1548 1548
         }
1549 1549
 
1550 1550
         if ($field instanceof Expression) {
@@ -1728,7 +1728,7 @@  discard block
 block discarded – undo
1728 1728
             list($offset, $length) = explode(',', $offset);
1729 1729
         }
1730 1730
 
1731
-        $this->options['limit'] = intval($offset) . ($length ? ',' . intval($length) : '');
1731
+        $this->options['limit'] = intval($offset).($length ? ','.intval($length) : '');
1732 1732
 
1733 1733
         return $this;
1734 1734
     }
@@ -1785,7 +1785,7 @@  discard block
 block discarded – undo
1785 1785
         }
1786 1786
 
1787 1787
         /** @var Paginator $class */
1788
-        $class = false !== strpos($config['type'], '\\') ? $config['type'] : '\\think\\paginator\\driver\\' . ucwords($config['type']);
1788
+        $class = false !== strpos($config['type'], '\\') ? $config['type'] : '\\think\\paginator\\driver\\'.ucwords($config['type']);
1789 1789
         $page  = isset($config['page']) ? (int) $config['page'] : call_user_func([
1790 1790
             $class,
1791 1791
             'getCurrentPage',
@@ -1895,7 +1895,7 @@  discard block
 block discarded – undo
1895 1895
 
1896 1896
         if (is_string($field)) {
1897 1897
             if (!empty($this->options['via'])) {
1898
-                $field = $this->options['via'] . '.' . $field;
1898
+                $field = $this->options['via'].'.'.$field;
1899 1899
             }
1900 1900
 
1901 1901
             if (strpos($field, ',')) {
@@ -1906,9 +1906,9 @@  discard block
 block discarded – undo
1906 1906
         } elseif (!empty($this->options['via'])) {
1907 1907
             foreach ($field as $key => $val) {
1908 1908
                 if (is_numeric($key)) {
1909
-                    $field[$key] = $this->options['via'] . '.' . $val;
1909
+                    $field[$key] = $this->options['via'].'.'.$val;
1910 1910
                 } else {
1911
-                    $field[$this->options['via'] . '.' . $key] = $val;
1911
+                    $field[$this->options['via'].'.'.$key] = $val;
1912 1912
                     unset($field[$key]);
1913 1913
                 }
1914 1914
             }
@@ -2320,7 +2320,7 @@  discard block
 block discarded – undo
2320 2320
         if ($this->model) {
2321 2321
             // 检查模型类的查询范围方法
2322 2322
             foreach ($scope as $name) {
2323
-                $method = 'scope' . trim($name);
2323
+                $method = 'scope'.trim($name);
2324 2324
 
2325 2325
                 if (method_exists($this->model, $method)) {
2326 2326
                     call_user_func_array([$this->model, $method], $args);
@@ -2347,7 +2347,7 @@  discard block
 block discarded – undo
2347 2347
             } elseif ($this->model) {
2348 2348
                 // 检测搜索器
2349 2349
                 $fieldName = is_numeric($key) ? $field : $key;
2350
-                $method    = 'search' . Loader::parseName($fieldName, 1) . 'Attr';
2350
+                $method    = 'search'.Loader::parseName($fieldName, 1).'Attr';
2351 2351
 
2352 2352
                 if (method_exists($this->model, $method)) {
2353 2353
                     $this->model->$method($this, isset($data[$field]) ? $data[$field] : null, $data, $prefix);
@@ -2412,7 +2412,7 @@  discard block
 block discarded – undo
2412 2412
             $op = is_array($range) ? 'between' : '>=';
2413 2413
         }
2414 2414
 
2415
-        return $this->parseWhereExp($logic, $field, strtolower($op) . ' time', $range, [], true);
2415
+        return $this->parseWhereExp($logic, $field, strtolower($op).' time', $range, [], true);
2416 2416
     }
2417 2417
 
2418 2418
     /**
@@ -2490,7 +2490,7 @@  discard block
 block discarded – undo
2490 2490
         if (is_array($value)) {
2491 2491
             $this->bind = array_merge($this->bind, $value);
2492 2492
         } else {
2493
-            $name = $name ?: 'ThinkBind_' . (count($this->bind) + 1) . '_' . mt_rand() . '_';
2493
+            $name = $name ?: 'ThinkBind_'.(count($this->bind) + 1).'_'.mt_rand().'_';
2494 2494
 
2495 2495
             $this->bind[$name] = [$value, $type];
2496 2496
             return $name;
@@ -2707,10 +2707,10 @@  discard block
 block discarded – undo
2707 2707
                 $count = $this->model->$relation()->getRelationCountQuery($closure, $aggregate, $field, $aggregateField);
2708 2708
 
2709 2709
                 if (empty($aggregateField)) {
2710
-                    $aggregateField = Loader::parseName($relation) . '_' . $aggregate;
2710
+                    $aggregateField = Loader::parseName($relation).'_'.$aggregate;
2711 2711
                 }
2712 2712
 
2713
-                $this->field(['(' . $count . ')' => $aggregateField]);
2713
+                $this->field(['('.$count.')' => $aggregateField]);
2714 2714
             }
2715 2715
         }
2716 2716
 
@@ -3429,10 +3429,10 @@  discard block
 block discarded – undo
3429 3429
     {
3430 3430
         if (!empty($this->model)) {
3431 3431
             $class = get_class($this->model);
3432
-            throw new ModelNotFoundException('model data Not Found:' . $class, $class, $options);
3432
+            throw new ModelNotFoundException('model data Not Found:'.$class, $class, $options);
3433 3433
         }
3434 3434
         $table = is_array($options['table']) ? key($options['table']) : $options['table'];
3435
-        throw new DataNotFoundException('table data not Found:' . $table, $table, $options);
3435
+        throw new DataNotFoundException('table data not Found:'.$table, $table, $options);
3436 3436
     }
3437 3437
 
3438 3438
     /**
@@ -3568,7 +3568,7 @@  discard block
 block discarded – undo
3568 3568
      */
3569 3569
     public function buildSql($sub = true)
3570 3570
     {
3571
-        return $sub ? '( ' . $this->select(false) . ' )' : $this->select(false);
3571
+        return $sub ? '( '.$this->select(false).' )' : $this->select(false);
3572 3572
     }
3573 3573
 
3574 3574
     /**
@@ -3639,7 +3639,7 @@  discard block
 block discarded – undo
3639 3639
         }
3640 3640
 
3641 3641
         if (is_string($pk)) {
3642
-            $key = isset($alias) ? $alias . '.' . $pk : $pk;
3642
+            $key = isset($alias) ? $alias.'.'.$pk : $pk;
3643 3643
             // 根据主键查询
3644 3644
             if (is_array($data)) {
3645 3645
                 $where[$pk] = isset($data[$pk]) ? [$key, '=', $data[$pk]] : [$key, 'in', $data];
@@ -3650,7 +3650,7 @@  discard block
 block discarded – undo
3650 3650
             // 根据复合主键查询
3651 3651
             foreach ($pk as $key) {
3652 3652
                 if (isset($data[$key])) {
3653
-                    $attr        = isset($alias) ? $alias . '.' . $key : $key;
3653
+                    $attr        = isset($alias) ? $alias.'.'.$key : $key;
3654 3654
                     $where[$key] = [$attr, '=', $data[$key]];
3655 3655
                 } else {
3656 3656
                     throw new Exception('miss complex primary data');
@@ -3726,7 +3726,7 @@  discard block
 block discarded – undo
3726 3726
             $page                  = $page > 0 ? $page : 1;
3727 3727
             $listRows              = $listRows > 0 ? $listRows : (is_numeric($options['limit']) ? $options['limit'] : 20);
3728 3728
             $offset                = $listRows * ($page - 1);
3729
-            $options['limit']      = $offset . ',' . $listRows;
3729
+            $options['limit']      = $offset.','.$listRows;
3730 3730
         }
3731 3731
 
3732 3732
         $this->options = $options;
Please login to merge, or discard this patch.
library/think/db/builder/Mysql.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
         foreach ($dataSet as $k => $data) {
65 65
             $data = $this->parseData($query, $data, $allowFields, $bind);
66 66
 
67
-            $values[] = '( ' . implode(',', array_values($data)) . ' )';
67
+            $values[] = '( '.implode(',', array_values($data)).' )';
68 68
 
69 69
             if (!isset($insertFields)) {
70 70
                 $insertFields = array_keys($data);
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
             $value = $value->getValue();
105 105
         }
106 106
 
107
-        return $key . ' ' . $exp . ' ' . $value;
107
+        return $key.' '.$exp.' '.$value;
108 108
     }
109 109
 
110 110
     /**
@@ -125,17 +125,17 @@  discard block
 block discarded – undo
125 125
 
126 126
         $key = trim($key);
127 127
 
128
-        if(strpos($key, '->>') && false === strpos($key, '(')){
128
+        if (strpos($key, '->>') && false === strpos($key, '(')) {
129 129
             // JSON字段支持
130 130
             list($field, $name) = explode('->>', $key, 2);
131 131
 
132
-            return $this->parseKey($query, $field, true) . '->>\'$' . (strpos($name, '[') === 0 ? '' : '.') . str_replace('->>', '.', $name) . '\'';
132
+            return $this->parseKey($query, $field, true).'->>\'$'.(strpos($name, '[') === 0 ? '' : '.').str_replace('->>', '.', $name).'\'';
133 133
         }
134 134
         elseif (strpos($key, '->') && false === strpos($key, '(')) {
135 135
             // JSON字段支持
136 136
             list($field, $name) = explode('->', $key, 2);
137 137
 
138
-            return 'json_extract(' . $this->parseKey($query, $field, true) . ', \'$' . (strpos($name, '[') === 0 ? '' : '.') . str_replace('->', '.', $name) . '\')';
138
+            return 'json_extract('.$this->parseKey($query, $field, true).', \'$'.(strpos($name, '[') === 0 ? '' : '.').str_replace('->', '.', $name).'\')';
139 139
         } elseif (strpos($key, '.') && !preg_match('/[,\'\"\(\)`\s]/', $key)) {
140 140
             list($table, $key) = explode('.', $key, 2);
141 141
 
@@ -152,11 +152,11 @@  discard block
 block discarded – undo
152 152
         }
153 153
 
154 154
         if ($strict && !preg_match('/^[\w\.\*]+$/', $key)) {
155
-            throw new Exception('not support data:' . $key);
155
+            throw new Exception('not support data:'.$key);
156 156
         }
157 157
 
158 158
         if ('*' != $key && !preg_match('/[,\'\"\*\(\)`.\s]/', $key)) {
159
-            $key = '`' . $key . '`';
159
+            $key = '`'.$key.'`';
160 160
         }
161 161
 
162 162
         if (isset($table)) {
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
                 $table = str_replace('.', '`.`', $table);
165 165
             }
166 166
 
167
-            $key = '`' . $table . '`.' . $key;
167
+            $key = '`'.$table.'`.'.$key;
168 168
         }
169 169
 
170 170
         return $key;
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -130,8 +130,7 @@
 block discarded – undo
130 130
             list($field, $name) = explode('->>', $key, 2);
131 131
 
132 132
             return $this->parseKey($query, $field, true) . '->>\'$' . (strpos($name, '[') === 0 ? '' : '.') . str_replace('->>', '.', $name) . '\'';
133
-        }
134
-        elseif (strpos($key, '->') && false === strpos($key, '(')) {
133
+        } elseif (strpos($key, '->') && false === strpos($key, '(')) {
135 134
             // JSON字段支持
136 135
             list($field, $name) = explode('->', $key, 2);
137 136
 
Please login to merge, or discard this patch.
library/think/model/relation/HasOne.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
         }
90 90
 
91 91
         return $this->query
92
-            ->whereExp($this->foreignKey, '=' . $this->parent->getTable() . '.' . $this->localKey)
92
+            ->whereExp($this->foreignKey, '='.$this->parent->getTable().'.'.$this->localKey)
93 93
             ->fetchSql()
94 94
             ->$aggregate($field);
95 95
     }
@@ -144,12 +144,12 @@  discard block
 block discarded – undo
144 144
 
145 145
         return $this->parent->db()
146 146
             ->alias($model)
147
-            ->whereExists(function ($query) use ($table, $model, $relation, $localKey, $foreignKey, $softDelete) {
147
+            ->whereExists(function($query) use ($table, $model, $relation, $localKey, $foreignKey, $softDelete) {
148 148
                 $query->table([$table => $relation])
149
-                    ->field($relation . '.' . $foreignKey)
150
-                    ->whereExp($model . '.' . $localKey, '=' . $relation . '.' . $foreignKey)
151
-                    ->when($softDelete, function ($query) use ($softDelete, $relation) {
152
-                        $query->where($relation . strstr($softDelete[0], '.'), '=' == $softDelete[1][0] ? $softDelete[1][1] : null);
149
+                    ->field($relation.'.'.$foreignKey)
150
+                    ->whereExp($model.'.'.$localKey, '='.$relation.'.'.$foreignKey)
151
+                    ->when($softDelete, function($query) use ($softDelete, $relation) {
152
+                        $query->where($relation.strstr($softDelete[0], '.'), '=' == $softDelete[1][0] ? $softDelete[1][1] : null);
153 153
                     });
154 154
             });
155 155
     }
@@ -177,9 +177,9 @@  discard block
 block discarded – undo
177 177
         return $this->parent->db()
178 178
             ->alias($model)
179 179
             ->field($fields)
180
-            ->join([$table => $relation], $model . '.' . $this->localKey . '=' . $relation . '.' . $this->foreignKey, $this->joinType)
181
-            ->when($softDelete, function ($query) use ($softDelete, $relation) {
182
-                $query->where($relation . strstr($softDelete[0], '.'), '=' == $softDelete[1][0] ? $softDelete[1][1] : null);
180
+            ->join([$table => $relation], $model.'.'.$this->localKey.'='.$relation.'.'.$this->foreignKey, $this->joinType)
181
+            ->when($softDelete, function($query) use ($softDelete, $relation) {
182
+                $query->where($relation.strstr($softDelete[0], '.'), '=' == $softDelete[1][0] ? $softDelete[1][1] : null);
183 183
             })
184 184
             ->where($where);
185 185
     }
Please login to merge, or discard this patch.
library/think/App.php 1 patch
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 
127 127
     public function __construct($appPath = '')
128 128
     {
129
-        $this->thinkPath = dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR;
129
+        $this->thinkPath = dirname(dirname(__DIR__)).DIRECTORY_SEPARATOR;
130 130
         $this->path($appPath);
131 131
     }
132 132
 
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
      */
151 151
     public function path($path)
152 152
     {
153
-        $this->appPath = $path ? realpath($path) . DIRECTORY_SEPARATOR : $this->getAppPath();
153
+        $this->appPath = $path ? realpath($path).DIRECTORY_SEPARATOR : $this->getAppPath();
154 154
 
155 155
         return $this;
156 156
     }
@@ -170,24 +170,24 @@  discard block
 block discarded – undo
170 170
         $this->beginTime   = microtime(true);
171 171
         $this->beginMem    = memory_get_usage();
172 172
 
173
-        $this->rootPath    = dirname($this->appPath) . DIRECTORY_SEPARATOR;
174
-        $this->runtimePath = $this->rootPath . 'runtime' . DIRECTORY_SEPARATOR;
175
-        $this->routePath   = $this->rootPath . 'route' . DIRECTORY_SEPARATOR;
176
-        $this->configPath  = $this->rootPath . 'config' . DIRECTORY_SEPARATOR;
173
+        $this->rootPath    = dirname($this->appPath).DIRECTORY_SEPARATOR;
174
+        $this->runtimePath = $this->rootPath.'runtime'.DIRECTORY_SEPARATOR;
175
+        $this->routePath   = $this->rootPath.'route'.DIRECTORY_SEPARATOR;
176
+        $this->configPath  = $this->rootPath.'config'.DIRECTORY_SEPARATOR;
177 177
 
178 178
         static::setInstance($this);
179 179
 
180 180
         $this->instance('app', $this);
181 181
 
182 182
         // 加载环境变量配置文件
183
-        if (is_file($this->rootPath . '.env')) {
184
-            $this->env->load($this->rootPath . '.env');
183
+        if (is_file($this->rootPath.'.env')) {
184
+            $this->env->load($this->rootPath.'.env');
185 185
         }
186 186
 
187 187
         $this->configExt = $this->env->get('config_ext', '.php');
188 188
 
189 189
         // 加载惯例配置文件
190
-        $this->config->set(include $this->thinkPath . 'convention.php');
190
+        $this->config->set(include $this->thinkPath.'convention.php');
191 191
 
192 192
         // 设置路径环境变量
193 193
         $this->env->set([
@@ -197,8 +197,8 @@  discard block
 block discarded – undo
197 197
             'config_path'  => $this->configPath,
198 198
             'route_path'   => $this->routePath,
199 199
             'runtime_path' => $this->runtimePath,
200
-            'extend_path'  => $this->rootPath . 'extend' . DIRECTORY_SEPARATOR,
201
-            'vendor_path'  => $this->rootPath . 'vendor' . DIRECTORY_SEPARATOR,
200
+            'extend_path'  => $this->rootPath.'extend'.DIRECTORY_SEPARATOR,
201
+            'vendor_path'  => $this->rootPath.'vendor'.DIRECTORY_SEPARATOR,
202 202
         ]);
203 203
 
204 204
         $this->namespace = $this->env->get('app_namespace', $this->namespace);
@@ -268,61 +268,61 @@  discard block
 block discarded – undo
268 268
     public function init($module = '')
269 269
     {
270 270
         // 定位模块目录
271
-        $module = $module ? $module . DIRECTORY_SEPARATOR : '';
272
-        $path   = $this->appPath . $module;
271
+        $module = $module ? $module.DIRECTORY_SEPARATOR : '';
272
+        $path   = $this->appPath.$module;
273 273
 
274 274
         // 加载初始化文件
275
-        if (is_file($path . 'init.php')) {
276
-            include $path . 'init.php';
277
-        } elseif (is_file($this->runtimePath . $module . 'init.php')) {
278
-            include $this->runtimePath . $module . 'init.php';
275
+        if (is_file($path.'init.php')) {
276
+            include $path.'init.php';
277
+        } elseif (is_file($this->runtimePath.$module.'init.php')) {
278
+            include $this->runtimePath.$module.'init.php';
279 279
         } else {
280 280
             // 加载行为扩展文件
281
-            if (is_file($path . 'tags.php')) {
282
-                $tags = include $path . 'tags.php';
281
+            if (is_file($path.'tags.php')) {
282
+                $tags = include $path.'tags.php';
283 283
                 if (is_array($tags)) {
284 284
                     $this->hook->import($tags);
285 285
                 }
286 286
             }
287 287
 
288 288
             // 加载公共文件
289
-            if (is_file($path . 'common.php')) {
290
-                include_once $path . 'common.php';
289
+            if (is_file($path.'common.php')) {
290
+                include_once $path.'common.php';
291 291
             }
292 292
 
293 293
             if ('' == $module) {
294 294
                 // 加载系统助手函数
295
-                include $this->thinkPath . 'helper.php';
295
+                include $this->thinkPath.'helper.php';
296 296
             }
297 297
 
298 298
             // 加载中间件
299
-            if (is_file($path . 'middleware.php')) {
300
-                $middleware = include $path . 'middleware.php';
299
+            if (is_file($path.'middleware.php')) {
300
+                $middleware = include $path.'middleware.php';
301 301
                 if (is_array($middleware)) {
302 302
                     $this->middleware->import($middleware);
303 303
                 }
304 304
             }
305 305
 
306 306
             // 注册服务的容器对象实例
307
-            if (is_file($path . 'provider.php')) {
308
-                $provider = include $path . 'provider.php';
307
+            if (is_file($path.'provider.php')) {
308
+                $provider = include $path.'provider.php';
309 309
                 if (is_array($provider)) {
310 310
                     $this->bindTo($provider);
311 311
                 }
312 312
             }
313 313
 
314 314
             // 自动读取配置文件
315
-            if (is_dir($path . 'config')) {
316
-                $dir = $path . 'config' . DIRECTORY_SEPARATOR;
317
-            } elseif (is_dir($this->configPath . $module)) {
318
-                $dir = $this->configPath . $module;
315
+            if (is_dir($path.'config')) {
316
+                $dir = $path.'config'.DIRECTORY_SEPARATOR;
317
+            } elseif (is_dir($this->configPath.$module)) {
318
+                $dir = $this->configPath.$module;
319 319
             }
320 320
 
321 321
             $files = isset($dir) ? scandir($dir) : [];
322 322
 
323 323
             foreach ($files as $file) {
324
-                if ('.' . pathinfo($file, PATHINFO_EXTENSION) === $this->configExt) {
325
-                    $this->config->load($dir . $file, pathinfo($file, PATHINFO_FILENAME));
324
+                if ('.'.pathinfo($file, PATHINFO_EXTENSION) === $this->configExt) {
325
+                    $this->config->load($dir.$file, pathinfo($file, PATHINFO_FILENAME));
326 326
                 }
327 327
             }
328 328
         }
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
         $this->cache->init($config['cache'], true);
357 357
 
358 358
         // 加载当前模块语言包
359
-        $this->lang->load($this->appPath . $module . DIRECTORY_SEPARATOR . 'lang' . DIRECTORY_SEPARATOR . $this->request->langset() . '.php');
359
+        $this->lang->load($this->appPath.$module.DIRECTORY_SEPARATOR.'lang'.DIRECTORY_SEPARATOR.$this->request->langset().'.php');
360 360
 
361 361
         // 模块请求缓存检查
362 362
         $this->checkRequestCache(
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
             } elseif ($this->config('app.auto_bind_module')) {
388 388
                 // 入口自动绑定
389 389
                 $name = pathinfo($this->request->baseFile(), PATHINFO_FILENAME);
390
-                if ($name && 'index' != $name && is_dir($this->appPath . $name)) {
390
+                if ($name && 'index' != $name && is_dir($this->appPath.$name)) {
391 391
                     $this->route->bind($name);
392 392
                 }
393 393
             }
@@ -407,9 +407,9 @@  discard block
 block discarded – undo
407 407
 
408 408
             // 记录路由和请求信息
409 409
             if ($this->appDebug) {
410
-                $this->log('[ ROUTE ] ' . var_export($this->request->routeInfo(), true));
411
-                $this->log('[ HEADER ] ' . var_export($this->request->header(), true));
412
-                $this->log('[ PARAM ] ' . var_export($this->request->param(), true));
410
+                $this->log('[ ROUTE ] '.var_export($this->request->routeInfo(), true));
411
+                $this->log('[ HEADER ] '.var_export($this->request->header(), true));
412
+                $this->log('[ PARAM ] '.var_export($this->request->param(), true));
413 413
             }
414 414
 
415 415
             // 监听app_begin
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
             $data     = $exception->getResponse();
429 429
         }
430 430
 
431
-        $this->middleware->add(function (Request $request, $next) use ($dispatch, $data) {
431
+        $this->middleware->add(function(Request $request, $next) use ($dispatch, $data) {
432 432
             return is_null($data) ? $dispatch->run() : $data;
433 433
         });
434 434
 
@@ -446,7 +446,7 @@  discard block
 block discarded – undo
446 446
             $closure  = $this->config->get('route_check_cache_key');
447 447
             $routeKey = $closure($this->request);
448 448
         } else {
449
-            $routeKey = md5($this->request->baseUrl(true) . ':' . $this->request->method());
449
+            $routeKey = md5($this->request->baseUrl(true).':'.$this->request->method());
450 450
         }
451 451
 
452 452
         return $routeKey;
@@ -466,8 +466,8 @@  discard block
 block discarded – undo
466 466
 
467 467
         // 加载系统语言包
468 468
         $this->lang->load([
469
-            $this->thinkPath . 'lang' . DIRECTORY_SEPARATOR . $this->request->langset() . '.php',
470
-            $this->appPath . 'lang' . DIRECTORY_SEPARATOR . $this->request->langset() . '.php',
469
+            $this->thinkPath.'lang'.DIRECTORY_SEPARATOR.$this->request->langset().'.php',
470
+            $this->appPath.'lang'.DIRECTORY_SEPARATOR.$this->request->langset().'.php',
471 471
         ]);
472 472
     }
473 473
 
@@ -549,7 +549,7 @@  discard block
 block discarded – undo
549 549
     {
550 550
         // 路由检测
551 551
         if (is_dir($this->routePath)) {
552
-            $files = glob($this->routePath . '*.php');
552
+            $files = glob($this->routePath.'*.php');
553 553
             foreach ($files as $file) {
554 554
                 $rules = include $file;
555 555
                 if (is_array($rules)) {
@@ -565,7 +565,7 @@  discard block
 block discarded – undo
565 565
                 $this->build->buildRoute($suffix);
566 566
             }
567 567
 
568
-            $filename = $this->runtimePath . 'build_route.php';
568
+            $filename = $this->runtimePath.'build_route.php';
569 569
 
570 570
             if (is_file($filename)) {
571 571
                 include $filename;
@@ -666,7 +666,7 @@  discard block
 block discarded – undo
666 666
      */
667 667
     public function create($name, $layer, $appendSuffix = false, $common = 'common')
668 668
     {
669
-        $guid = $name . $layer;
669
+        $guid = $name.$layer;
670 670
 
671 671
         if ($this->__isset($guid)) {
672 672
             return $this->__get($guid);
@@ -677,11 +677,11 @@  discard block
 block discarded – undo
677 677
         if (class_exists($class)) {
678 678
             $object = $this->__get($class);
679 679
         } else {
680
-            $class = str_replace('\\' . $module . '\\', '\\' . $common . '\\', $class);
680
+            $class = str_replace('\\'.$module.'\\', '\\'.$common.'\\', $class);
681 681
             if (class_exists($class)) {
682 682
                 $object = $this->__get($class);
683 683
             } else {
684
-                throw new ClassNotFoundException('class not exists:' . $class, $class);
684
+                throw new ClassNotFoundException('class not exists:'.$class, $class);
685 685
             }
686 686
         }
687 687
 
@@ -725,7 +725,7 @@  discard block
 block discarded – undo
725 725
             return $this->make($emptyClass, true);
726 726
         }
727 727
 
728
-        throw new ClassNotFoundException('class not exists:' . $class, $class);
728
+        throw new ClassNotFoundException('class not exists:'.$class, $class);
729 729
     }
730 730
 
731 731
     /**
@@ -786,7 +786,7 @@  discard block
 block discarded – undo
786 786
             }
787 787
         }
788 788
 
789
-        return $this->invokeMethod([$class, $action . $this->config('action_suffix')], $vars);
789
+        return $this->invokeMethod([$class, $action.$this->config('action_suffix')], $vars);
790 790
     }
791 791
 
792 792
     /**
@@ -802,10 +802,10 @@  discard block
 block discarded – undo
802 802
     {
803 803
         $name  = str_replace(['/', '.'], '\\', $name);
804 804
         $array = explode('\\', $name);
805
-        $class = Loader::parseName(array_pop($array), 1) . ($this->suffix || $appendSuffix ? ucfirst($layer) : '');
806
-        $path  = $array ? implode('\\', $array) . '\\' : '';
805
+        $class = Loader::parseName(array_pop($array), 1).($this->suffix || $appendSuffix ? ucfirst($layer) : '');
806
+        $path  = $array ? implode('\\', $array).'\\' : '';
807 807
 
808
-        return $this->namespace . '\\' . ($module ? $module . '\\' : '') . $layer . '\\' . $path . $class;
808
+        return $this->namespace.'\\'.($module ? $module.'\\' : '').$layer.'\\'.$path.$class;
809 809
     }
810 810
 
811 811
     /**
@@ -868,7 +868,7 @@  discard block
 block discarded – undo
868 868
     public function getAppPath()
869 869
     {
870 870
         if (is_null($this->appPath)) {
871
-            $this->appPath = Loader::getRootPath() . 'application' . DIRECTORY_SEPARATOR;
871
+            $this->appPath = Loader::getRootPath().'application'.DIRECTORY_SEPARATOR;
872 872
         }
873 873
 
874 874
         return $this->appPath;
Please login to merge, or discard this patch.
library/think/Request.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
             return call_user_func_array($this->hook[$method], $args);
332 332
         }
333 333
 
334
-        throw new Exception('method not exists:' . static::class . '->' . $method);
334
+        throw new Exception('method not exists:'.static::class.'->'.$method);
335 335
     }
336 336
 
337 337
     /**
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
 
386 386
         if (isset($info['port'])) {
387 387
             $server['SERVER_PORT'] = $info['port'];
388
-            $server['HTTP_HOST']   = $server['HTTP_HOST'] . ':' . $info['port'];
388
+            $server['HTTP_HOST']   = $server['HTTP_HOST'].':'.$info['port'];
389 389
         }
390 390
 
391 391
         if (isset($info['user'])) {
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
             $options['get'] = isset($options['get']) ? array_merge($get, $options['get']) : $get;
424 424
         }
425 425
 
426
-        $server['REQUEST_URI']  = $info['path'] . ('' !== $queryString ? '?' . $queryString : '');
426
+        $server['REQUEST_URI']  = $info['path'].('' !== $queryString ? '?'.$queryString : '');
427 427
         $server['QUERY_STRING'] = $queryString;
428 428
         $options['cookie']      = $cookie;
429 429
         $options['param']       = $params;
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
         $options['baseUrl']     = $info['path'];
434 434
         $options['pathinfo']    = '/' == $info['path'] ? '/' : ltrim($info['path'], '/');
435 435
         $options['method']      = $server['REQUEST_METHOD'];
436
-        $options['domain']      = isset($info['scheme']) ? $info['scheme'] . '://' . $server['HTTP_HOST'] : '';
436
+        $options['domain']      = isset($info['scheme']) ? $info['scheme'].'://'.$server['HTTP_HOST'] : '';
437 437
         $options['content']     = $content;
438 438
 
439 439
         $request = new static();
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
      */
455 455
     public function domain($port = false)
456 456
     {
457
-        return $this->scheme() . '://' . $this->host($port);
457
+        return $this->scheme().'://'.$this->host($port);
458 458
     }
459 459
 
460 460
     /**
@@ -469,7 +469,7 @@  discard block
 block discarded – undo
469 469
         if (!$root) {
470 470
             $item  = explode('.', $this->host(true));
471 471
             $count = count($item);
472
-            $root  = $count > 1 ? $item[$count - 2] . '.' . $item[$count - 1] : $item[0];
472
+            $root  = $count > 1 ? $item[$count - 2].'.'.$item[$count - 1] : $item[0];
473 473
         }
474 474
 
475 475
         return $root;
@@ -549,13 +549,13 @@  discard block
 block discarded – undo
549 549
             } elseif ($this->server('REQUEST_URI')) {
550 550
                 $this->url = $this->server('REQUEST_URI');
551 551
             } elseif ($this->server('ORIG_PATH_INFO')) {
552
-                $this->url = $this->server('ORIG_PATH_INFO') . (!empty($this->server('QUERY_STRING')) ? '?' . $this->server('QUERY_STRING') : '');
552
+                $this->url = $this->server('ORIG_PATH_INFO').(!empty($this->server('QUERY_STRING')) ? '?'.$this->server('QUERY_STRING') : '');
553 553
             } else {
554 554
                 $this->url = '';
555 555
             }
556 556
         }
557 557
 
558
-        return $complete ? $this->domain() . $this->url : $this->url;
558
+        return $complete ? $this->domain().$this->url : $this->url;
559 559
     }
560 560
 
561 561
     /**
@@ -583,7 +583,7 @@  discard block
 block discarded – undo
583 583
             $this->baseUrl = strpos($str, '?') ? strstr($str, '?', true) : $str;
584 584
         }
585 585
 
586
-        return $domain ? $this->domain() . $this->baseUrl : $this->baseUrl;
586
+        return $domain ? $this->domain().$this->baseUrl : $this->baseUrl;
587 587
     }
588 588
 
589 589
     /**
@@ -604,8 +604,8 @@  discard block
 block discarded – undo
604 604
                     $url = $this->server('PHP_SELF');
605 605
                 } elseif (basename($this->server('ORIG_SCRIPT_NAME')) === $script_name) {
606 606
                     $url = $this->server('ORIG_SCRIPT_NAME');
607
-                } elseif (($pos = strpos($this->server('PHP_SELF'), '/' . $script_name)) !== false) {
608
-                    $url = substr($this->server('SCRIPT_NAME'), 0, $pos) . '/' . $script_name;
607
+                } elseif (($pos = strpos($this->server('PHP_SELF'), '/'.$script_name)) !== false) {
608
+                    $url = substr($this->server('SCRIPT_NAME'), 0, $pos).'/'.$script_name;
609 609
                 } elseif ($this->server('DOCUMENT_ROOT') && strpos($this->server('SCRIPT_FILENAME'), $this->server('DOCUMENT_ROOT')) === 0) {
610 610
                     $url = str_replace('\\', '/', str_replace($this->server('DOCUMENT_ROOT'), '', $this->server('SCRIPT_FILENAME')));
611 611
                 }
@@ -613,7 +613,7 @@  discard block
 block discarded – undo
613 613
             $this->baseFile = $url;
614 614
         }
615 615
 
616
-        return $domain ? $this->domain() . $this->baseFile : $this->baseFile;
616
+        return $domain ? $this->domain().$this->baseFile : $this->baseFile;
617 617
     }
618 618
 
619 619
     /**
@@ -644,7 +644,7 @@  discard block
 block discarded – undo
644 644
             $this->root = rtrim($file, '/');
645 645
         }
646 646
 
647
-        return $domain ? $this->domain() . $this->root : $this->root;
647
+        return $domain ? $this->domain().$this->root : $this->root;
648 648
     }
649 649
 
650 650
     /**
@@ -658,7 +658,7 @@  discard block
 block discarded – undo
658 658
         $root = strpos($base, '.') ? ltrim(dirname($base), DIRECTORY_SEPARATOR) : $base;
659 659
 
660 660
         if ('' != $root) {
661
-            $root = '/' . ltrim($root, '/');
661
+            $root = '/'.ltrim($root, '/');
662 662
         }
663 663
 
664 664
         return $root;
@@ -729,10 +729,10 @@  discard block
 block discarded – undo
729 729
                 $this->path = $pathinfo;
730 730
             } elseif ($suffix) {
731 731
                 // 去除正常的URL后缀
732
-                $this->path = preg_replace('/\.(' . ltrim($suffix, '.') . ')$/i', '', $pathinfo);
732
+                $this->path = preg_replace('/\.('.ltrim($suffix, '.').')$/i', '', $pathinfo);
733 733
             } else {
734 734
                 // 允许任何后缀访问
735
-                $this->path = preg_replace('/\.' . $this->ext() . '$/i', '', $pathinfo);
735
+                $this->path = preg_replace('/\.'.$this->ext().'$/i', '', $pathinfo);
736 736
             }
737 737
         }
738 738
 
@@ -1211,8 +1211,8 @@  discard block
 block discarded – undo
1211 1211
             if ($file instanceof File) {
1212 1212
                 $array[$key] = $file;
1213 1213
             } elseif (is_array($file['name'])) {
1214
-                $keys  = array_keys($file);
1215
-                $subFileNames=array_keys($file['name']);
1214
+                $keys = array_keys($file);
1215
+                $subFileNames = array_keys($file['name']);
1216 1216
 
1217 1217
                 foreach ($subFileNames as $index => $subFileName) {
1218 1218
                     if ($file['error'][$subFileName] > 0) {
@@ -1512,7 +1512,7 @@  discard block
 block discarded – undo
1512 1512
                 if (is_scalar($data)) {
1513 1513
                     $data = (string) $data;
1514 1514
                 } else {
1515
-                    throw new \InvalidArgumentException('variable type error:' . gettype($data));
1515
+                    throw new \InvalidArgumentException('variable type error:'.gettype($data));
1516 1516
                 }
1517 1517
                 break;
1518 1518
         }
@@ -2024,7 +2024,7 @@  discard block
 block discarded – undo
2024 2024
         $token = call_user_func($type, $this->server('REQUEST_TIME_FLOAT'));
2025 2025
 
2026 2026
         if ($this->isAjax()) {
2027
-            header($name . ': ' . $token);
2027
+            header($name.': '.$token);
2028 2028
         }
2029 2029
 
2030 2030
         facade\Session::set($name, $token);
@@ -2079,12 +2079,12 @@  discard block
 block discarded – undo
2079 2079
         if (false !== strpos($key, ':')) {
2080 2080
             $param = $this->param();
2081 2081
             foreach ($param as $item => $val) {
2082
-                if (is_string($val) && false !== strpos($key, ':' . $item)) {
2083
-                    $key = str_replace(':' . $item, $val, $key);
2082
+                if (is_string($val) && false !== strpos($key, ':'.$item)) {
2083
+                    $key = str_replace(':'.$item, $val, $key);
2084 2084
                 }
2085 2085
             }
2086 2086
         } elseif (strpos($key, ']')) {
2087
-            if ('[' . $this->ext() . ']' == $key) {
2087
+            if ('['.$this->ext().']' == $key) {
2088 2088
                 // 缓存某个后缀的请求
2089 2089
                 $key = md5($this->url());
2090 2090
             } else {
Please login to merge, or discard this patch.