Passed
Push — 5.1 ( 9dd7e1...5e68bf )
by liu
10:33
created
library/think/Log.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -120,7 +120,7 @@
 block discarded – undo
120 120
         if (is_string($msg) && !empty($context)) {
121 121
             $replace = [];
122 122
             foreach ($context as $key => $val) {
123
-                $replace['{' . $key . '}'] = $val;
123
+                $replace['{'.$key.'}'] = $val;
124 124
             }
125 125
 
126 126
             $msg = strtr($msg, $replace);
Please login to merge, or discard this patch.
library/think/Session.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -188,11 +188,11 @@  discard block
 block discarded – undo
188 188
 
189 189
         if (!empty($config['type'])) {
190 190
             // 读取session驱动
191
-            $class = false !== strpos($config['type'], '\\') ? $config['type'] : '\\think\\session\\driver\\' . ucwords($config['type']);
191
+            $class = false !== strpos($config['type'], '\\') ? $config['type'] : '\\think\\session\\driver\\'.ucwords($config['type']);
192 192
 
193 193
             // 检查驱动类
194 194
             if (!class_exists($class) || !session_set_save_handler(new $class($config))) {
195
-                throw new ClassNotFoundException('error session handler:' . $class, $class);
195
+                throw new ClassNotFoundException('error session handler:'.$class, $class);
196 196
             }
197 197
         }
198 198
 
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
 
302 302
         if (!empty($config['type']) && isset($config['use_lock']) && $config['use_lock']) {
303 303
             // 读取session驱动
304
-            $class = false !== strpos($config['type'], '\\') ? $config['type'] : '\\think\\session\\driver\\' . ucwords($config['type']);
304
+            $class = false !== strpos($config['type'], '\\') ? $config['type'] : '\\think\\session\\driver\\'.ucwords($config['type']);
305 305
 
306 306
             // 检查驱动类及类中是否存在 lock 和 unlock 函数
307 307
             if (class_exists($class) && method_exists($class, 'lock') && method_exists($class, 'unlock')) {
Please login to merge, or discard this patch.
library/think/Loader.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -65,11 +65,11 @@  discard block
 block discarded – undo
65 65
 
66 66
         $path = realpath(dirname($scriptName));
67 67
 
68
-        if (!is_file($path . DIRECTORY_SEPARATOR . 'think')) {
68
+        if (!is_file($path.DIRECTORY_SEPARATOR.'think')) {
69 69
             $path = dirname($path);
70 70
         }
71 71
 
72
-        return $path . DIRECTORY_SEPARATOR;
72
+        return $path.DIRECTORY_SEPARATOR;
73 73
     }
74 74
 
75 75
     // 注册自动加载机制
@@ -80,12 +80,12 @@  discard block
 block discarded – undo
80 80
 
81 81
         $rootPath = self::getRootPath();
82 82
 
83
-        self::$composerPath = $rootPath . 'vendor' . DIRECTORY_SEPARATOR . 'composer' . DIRECTORY_SEPARATOR;
83
+        self::$composerPath = $rootPath.'vendor'.DIRECTORY_SEPARATOR.'composer'.DIRECTORY_SEPARATOR;
84 84
 
85 85
         // Composer自动加载支持
86 86
         if (is_dir(self::$composerPath)) {
87
-            if (is_file(self::$composerPath . 'autoload_static.php')) {
88
-                require self::$composerPath . 'autoload_static.php';
87
+            if (is_file(self::$composerPath.'autoload_static.php')) {
88
+                require self::$composerPath.'autoload_static.php';
89 89
 
90 90
                 $declaredClass = get_declared_classes();
91 91
                 $composerClass = array_pop($declaredClass);
@@ -103,16 +103,16 @@  discard block
 block discarded – undo
103 103
         // 注册命名空间定义
104 104
         self::addNamespace([
105 105
             'think'  => __DIR__,
106
-            'traits' => dirname(__DIR__) . DIRECTORY_SEPARATOR . 'traits',
106
+            'traits' => dirname(__DIR__).DIRECTORY_SEPARATOR.'traits',
107 107
         ]);
108 108
 
109 109
         // 加载类库映射文件
110
-        if (is_file($rootPath . 'runtime' . DIRECTORY_SEPARATOR . 'classmap.php')) {
111
-            self::addClassMap(__include_file($rootPath . 'runtime' . DIRECTORY_SEPARATOR . 'classmap.php'));
110
+        if (is_file($rootPath.'runtime'.DIRECTORY_SEPARATOR.'classmap.php')) {
111
+            self::addClassMap(__include_file($rootPath.'runtime'.DIRECTORY_SEPARATOR.'classmap.php'));
112 112
         }
113 113
 
114 114
         // 自动加载extend目录
115
-        self::addAutoLoadDir($rootPath . 'extend');
115
+        self::addAutoLoadDir($rootPath.'extend');
116 116
     }
117 117
 
118 118
     // 自动加载
@@ -148,14 +148,14 @@  discard block
 block discarded – undo
148 148
         }
149 149
 
150 150
         // 查找 PSR-4
151
-        $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . '.php';
151
+        $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR).'.php';
152 152
 
153 153
         $first = $class[0];
154 154
         if (isset(self::$prefixLengthsPsr4[$first])) {
155 155
             foreach (self::$prefixLengthsPsr4[$first] as $prefix => $length) {
156 156
                 if (0 === strpos($class, $prefix)) {
157 157
                     foreach (self::$prefixDirsPsr4[$prefix] as $dir) {
158
-                        if (is_file($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {
158
+                        if (is_file($file = $dir.DIRECTORY_SEPARATOR.substr($logicalPathPsr4, $length))) {
159 159
                             return $file;
160 160
                         }
161 161
                     }
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 
166 166
         // 查找 PSR-4 fallback dirs
167 167
         foreach (self::$fallbackDirsPsr4 as $dir) {
168
-            if (is_file($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
168
+            if (is_file($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr4)) {
169 169
                 return $file;
170 170
             }
171 171
         }
@@ -177,14 +177,14 @@  discard block
 block discarded – undo
177 177
             . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
178 178
         } else {
179 179
             // PEAR-like class name
180
-            $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . '.php';
180
+            $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR).'.php';
181 181
         }
182 182
 
183 183
         if (isset(self::$prefixesPsr0[$first])) {
184 184
             foreach (self::$prefixesPsr0[$first] as $prefix => $dirs) {
185 185
                 if (0 === strpos($class, $prefix)) {
186 186
                     foreach ($dirs as $dir) {
187
-                        if (is_file($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
187
+                        if (is_file($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr0)) {
188 188
                             return $file;
189 189
                         }
190 190
                     }
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 
195 195
         // 查找 PSR-0 fallback dirs
196 196
         foreach (self::$fallbackDirsPsr0 as $dir) {
197
-            if (is_file($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
197
+            if (is_file($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr0)) {
198 198
                 return $file;
199 199
             }
200 200
         }
@@ -217,10 +217,10 @@  discard block
 block discarded – undo
217 217
     {
218 218
         if (is_array($namespace)) {
219 219
             foreach ($namespace as $prefix => $paths) {
220
-                self::addPsr4($prefix . '\\', rtrim($paths, DIRECTORY_SEPARATOR), true);
220
+                self::addPsr4($prefix.'\\', rtrim($paths, DIRECTORY_SEPARATOR), true);
221 221
             }
222 222
         } else {
223
-            self::addPsr4($namespace . '\\', rtrim($path, DIRECTORY_SEPARATOR), true);
223
+            self::addPsr4($namespace.'\\', rtrim($path, DIRECTORY_SEPARATOR), true);
224 224
         }
225 225
     }
226 226
 
@@ -322,29 +322,29 @@  discard block
 block discarded – undo
322 322
     // 注册composer自动加载
323 323
     public static function registerComposerLoader($composerPath)
324 324
     {
325
-        if (is_file($composerPath . 'autoload_namespaces.php')) {
326
-            $map = require $composerPath . 'autoload_namespaces.php';
325
+        if (is_file($composerPath.'autoload_namespaces.php')) {
326
+            $map = require $composerPath.'autoload_namespaces.php';
327 327
             foreach ($map as $namespace => $path) {
328 328
                 self::addPsr0($namespace, $path);
329 329
             }
330 330
         }
331 331
 
332
-        if (is_file($composerPath . 'autoload_psr4.php')) {
333
-            $map = require $composerPath . 'autoload_psr4.php';
332
+        if (is_file($composerPath.'autoload_psr4.php')) {
333
+            $map = require $composerPath.'autoload_psr4.php';
334 334
             foreach ($map as $namespace => $path) {
335 335
                 self::addPsr4($namespace, $path);
336 336
             }
337 337
         }
338 338
 
339
-        if (is_file($composerPath . 'autoload_classmap.php')) {
340
-            $classMap = require $composerPath . 'autoload_classmap.php';
339
+        if (is_file($composerPath.'autoload_classmap.php')) {
340
+            $classMap = require $composerPath.'autoload_classmap.php';
341 341
             if ($classMap) {
342 342
                 self::addClassMap($classMap);
343 343
             }
344 344
         }
345 345
 
346
-        if (is_file($composerPath . 'autoload_files.php')) {
347
-            self::$files = require $composerPath . 'autoload_files.php';
346
+        if (is_file($composerPath.'autoload_files.php')) {
347
+            self::$files = require $composerPath.'autoload_files.php';
348 348
         }
349 349
     }
350 350
 
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
     public static function parseName($name, $type = 0, $ucfirst = true)
373 373
     {
374 374
         if ($type) {
375
-            $name = preg_replace_callback('/_([a-zA-Z])/', function ($match) {
375
+            $name = preg_replace_callback('/_([a-zA-Z])/', function($match) {
376 376
                 return strtoupper($match[1]);
377 377
             }, $name);
378 378
             return $ucfirst ? ucfirst($name) : lcfirst($name);
@@ -390,12 +390,12 @@  discard block
 block discarded – undo
390 390
      */
391 391
     public static function factory($name, $namespace = '', ...$args)
392 392
     {
393
-        $class = false !== strpos($name, '\\') ? $name : $namespace . ucwords($name);
393
+        $class = false !== strpos($name, '\\') ? $name : $namespace.ucwords($name);
394 394
 
395 395
         if (class_exists($class)) {
396 396
             return Container::getInstance()->invokeClass($class, $args);
397 397
         } else {
398
-            throw new ClassNotFoundException('class not exists:' . $class, $class);
398
+            throw new ClassNotFoundException('class not exists:'.$class, $class);
399 399
         }
400 400
     }
401 401
 }
Please login to merge, or discard this patch.
library/think/Container.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
 
347 347
             return call_user_func_array($function, $args);
348 348
         } catch (ReflectionException $e) {
349
-            throw new Exception('function not exists: ' . $function . '()');
349
+            throw new Exception('function not exists: '.$function.'()');
350 350
         }
351 351
     }
352 352
 
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
                 $method[0] = get_class($method[0]);
377 377
             }
378 378
 
379
-            throw new Exception('method not exists: ' . (is_array($method) ? $method[0] . '::' . $method[1] : $method) . '()');
379
+            throw new Exception('method not exists: '.(is_array($method) ? $method[0].'::'.$method[1] : $method).'()');
380 380
         }
381 381
     }
382 382
 
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
             return $reflect->newInstanceArgs($args);
440 440
 
441 441
         } catch (ReflectionException $e) {
442
-            throw new ClassNotFoundException('class not exists: ' . $class, $class);
442
+            throw new ClassNotFoundException('class not exists: '.$class, $class);
443 443
         }
444 444
     }
445 445
 
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
             } elseif ($param->isDefaultValueAvailable()) {
478 478
                 $args[] = $param->getDefaultValue();
479 479
             } else {
480
-                throw new InvalidArgumentException('method param miss:' . $name);
480
+                throw new InvalidArgumentException('method param miss:'.$name);
481 481
             }
482 482
         }
483 483
 
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.