Passed
Push — 5.1 ( d4cd58...f8df25 )
by liu
09:32
created
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.
library/think/db/connector/Mysql.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
     protected function initialize()
32 32
     {
33 33
         // Point类型支持
34
-        Query::extend('point', function ($query, $field, $value = null, $fun = 'GeomFromText', $type = 'POINT') {
34
+        Query::extend('point', function($query, $field, $value = null, $fun = 'GeomFromText', $type = 'POINT') {
35 35
             if (!is_null($value)) {
36 36
                 $query->data($field, ['point', $value, $fun, $type]);
37 37
             } else {
@@ -54,16 +54,16 @@  discard block
 block discarded – undo
54 54
     protected function parseDsn($config)
55 55
     {
56 56
         if (!empty($config['socket'])) {
57
-            $dsn = 'mysql:unix_socket=' . $config['socket'];
57
+            $dsn = 'mysql:unix_socket='.$config['socket'];
58 58
         } elseif (!empty($config['hostport'])) {
59
-            $dsn = 'mysql:host=' . $config['hostname'] . ';port=' . $config['hostport'];
59
+            $dsn = 'mysql:host='.$config['hostname'].';port='.$config['hostport'];
60 60
         } else {
61
-            $dsn = 'mysql:host=' . $config['hostname'];
61
+            $dsn = 'mysql:host='.$config['hostname'];
62 62
         }
63
-        $dsn .= ';dbname=' . $config['database'];
63
+        $dsn .= ';dbname='.$config['database'];
64 64
 
65 65
         if (!empty($config['charset'])) {
66
-            $dsn .= ';charset=' . $config['charset'];
66
+            $dsn .= ';charset='.$config['charset'];
67 67
         }
68 68
 
69 69
         return $dsn;
@@ -83,10 +83,10 @@  discard block
 block discarded – undo
83 83
             if (strpos($tableName, '.')) {
84 84
                 $tableName = str_replace('.', '`.`', $tableName);
85 85
             }
86
-            $tableName = '`' . $tableName . '`';
86
+            $tableName = '`'.$tableName.'`';
87 87
         }
88 88
 
89
-        $sql    = 'SHOW COLUMNS FROM ' . $tableName;
89
+        $sql    = 'SHOW COLUMNS FROM '.$tableName;
90 90
         $pdo    = $this->query($sql, [], false, true);
91 91
         $result = $pdo->fetchAll(PDO::FETCH_ASSOC);
92 92
         $info   = [];
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
      */
117 117
     public function getTables($dbName = '')
118 118
     {
119
-        $sql    = !empty($dbName) ? 'SHOW TABLES FROM ' . $dbName : 'SHOW TABLES ';
119
+        $sql    = !empty($dbName) ? 'SHOW TABLES FROM '.$dbName : 'SHOW TABLES ';
120 120
         $pdo    = $this->query($sql, [], false, true);
121 121
         $result = $pdo->fetchAll(PDO::FETCH_ASSOC);
122 122
         $info   = [];
@@ -136,11 +136,11 @@  discard block
 block discarded – undo
136 136
      */
137 137
     protected function getExplain($sql)
138 138
     {
139
-        $pdo = $this->linkID->prepare("EXPLAIN " . $this->queryStr);
139
+        $pdo = $this->linkID->prepare("EXPLAIN ".$this->queryStr);
140 140
 
141 141
         foreach ($this->bind as $key => $val) {
142 142
             // 占位符
143
-            $param = is_int($key) ? $key + 1 : ':' . $key;
143
+            $param = is_int($key) ? $key + 1 : ':'.$key;
144 144
 
145 145
             if (is_array($val)) {
146 146
                 if (PDO::PARAM_INT == $val[1] && '' === $val[0]) {
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 
163 163
         if (isset($result['extra'])) {
164 164
             if (strpos($result['extra'], 'filesort') || strpos($result['extra'], 'temporary')) {
165
-                $this->log('SQL:' . $this->queryStr . '[' . $result['extra'] . ']', 'warn');
165
+                $this->log('SQL:'.$this->queryStr.'['.$result['extra'].']', 'warn');
166 166
             }
167 167
         }
168 168
 
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
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
         }
89 89
 
90 90
         return $this->query
91
-            ->whereExp($this->foreignKey, '=' . $this->parent->getTable() . '.' . $this->localKey)
91
+            ->whereExp($this->foreignKey, '='.$this->parent->getTable().'.'.$this->localKey)
92 92
             ->fetchSql()
93 93
             ->$aggregate($field);
94 94
     }
@@ -143,12 +143,12 @@  discard block
 block discarded – undo
143 143
 
144 144
         return $this->parent->db()
145 145
             ->alias($model)
146
-            ->whereExists(function ($query) use ($table, $model, $relation, $localKey, $foreignKey) {
146
+            ->whereExists(function($query) use ($table, $model, $relation, $localKey, $foreignKey) {
147 147
                 $query->table([$table => $relation])
148
-                    ->field($relation . '.' . $foreignKey)
149
-                    ->whereExp($model . '.' . $localKey, '=' . $relation . '.' . $foreignKey)
150
-                    ->when($softDelete, function ($query) use ($softDelete, $relation) {
151
-                        $query->where($relation . strstr($softDelete[0], '.'), '=' == $softDelete[1][0] ? $softDelete[1][1] : null);
148
+                    ->field($relation.'.'.$foreignKey)
149
+                    ->whereExp($model.'.'.$localKey, '='.$relation.'.'.$foreignKey)
150
+                    ->when($softDelete, function($query) use ($softDelete, $relation) {
151
+                        $query->where($relation.strstr($softDelete[0], '.'), '=' == $softDelete[1][0] ? $softDelete[1][1] : null);
152 152
                     });
153 153
             });
154 154
     }
@@ -176,9 +176,9 @@  discard block
 block discarded – undo
176 176
         return $this->parent->db()
177 177
             ->alias($model)
178 178
             ->field($fields)
179
-            ->join([$table => $relation], $model . '.' . $this->localKey . '=' . $relation . '.' . $this->foreignKey, $this->joinType)
180
-            ->when($softDelete, function ($query) use ($softDelete, $relation) {
181
-                $query->where($relation . strstr($softDelete[0], '.'), '=' == $softDelete[1][0] ? $softDelete[1][1] : null);
179
+            ->join([$table => $relation], $model.'.'.$this->localKey.'='.$relation.'.'.$this->foreignKey, $this->joinType)
180
+            ->when($softDelete, function($query) use ($softDelete, $relation) {
181
+                $query->where($relation.strstr($softDelete[0], '.'), '=' == $softDelete[1][0] ? $softDelete[1][1] : null);
182 182
             })
183 183
             ->where($where);
184 184
     }
Please login to merge, or discard this patch.
library/think/model/relation/HasMany.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -194,8 +194,8 @@  discard block
 block discarded – undo
194 194
             }
195 195
         }
196 196
 
197
-        return $this->query->alias($aggregate . '_table')
198
-            ->whereExp($aggregate . '_table.' . $this->foreignKey, '=' . $this->parent->getTable() . '.' . $this->localKey)
197
+        return $this->query->alias($aggregate.'_table')
198
+            ->whereExp($aggregate.'_table.'.$this->foreignKey, '='.$this->parent->getTable().'.'.$this->localKey)
199 199
             ->fetchSql()
200 200
             ->$aggregate($field);
201 201
     }
@@ -299,13 +299,13 @@  discard block
 block discarded – undo
299 299
 
300 300
         return $this->parent->db()
301 301
             ->alias($model)
302
-            ->field($model . '.*')
303
-            ->join([$table => $relation], $model . '.' . $this->localKey . '=' . $relation . '.' . $this->foreignKey, $joinType)
304
-            ->when($softDelete, function ($query) use ($softDelete, $relation) {
305
-                $query->where($relation . strstr($softDelete[0], '.'), '=' == $softDelete[1][0] ? $softDelete[1][1] : null);
302
+            ->field($model.'.*')
303
+            ->join([$table => $relation], $model.'.'.$this->localKey.'='.$relation.'.'.$this->foreignKey, $joinType)
304
+            ->when($softDelete, function($query) use ($softDelete, $relation) {
305
+                $query->where($relation.strstr($softDelete[0], '.'), '=' == $softDelete[1][0] ? $softDelete[1][1] : null);
306 306
             })
307
-            ->group($relation . '.' . $this->foreignKey)
308
-            ->having('count(' . $id . ')' . $operator . $count);
307
+            ->group($relation.'.'.$this->foreignKey)
308
+            ->having('count('.$id.')'.$operator.$count);
309 309
     }
310 310
 
311 311
     /**
@@ -330,11 +330,11 @@  discard block
 block discarded – undo
330 330
 
331 331
         return $this->parent->db()
332 332
             ->alias($model)
333
-            ->group($model . '.' . $this->localKey)
333
+            ->group($model.'.'.$this->localKey)
334 334
             ->field($fields)
335
-            ->join([$table => $relation], $model . '.' . $this->localKey . '=' . $relation . '.' . $this->foreignKey)
336
-            ->when($softDelete, function ($query) use ($softDelete, $relation) {
337
-                $query->where($relation . strstr($softDelete[0], '.'), '=' == $softDelete[1][0] ? $softDelete[1][1] : null);
335
+            ->join([$table => $relation], $model.'.'.$this->localKey.'='.$relation.'.'.$this->foreignKey)
336
+            ->when($softDelete, function($query) use ($softDelete, $relation) {
337
+                $query->where($relation.strstr($softDelete[0], '.'), '=' == $softDelete[1][0] ? $softDelete[1][1] : null);
338 338
             })
339 339
             ->where($where);
340 340
     }
Please login to merge, or discard this patch.
library/think/model/relation/BelongsTo.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
         }
89 89
 
90 90
         return $this->query
91
-            ->whereExp($this->localKey, '=' . $this->parent->getTable() . '.' . $this->foreignKey)
91
+            ->whereExp($this->localKey, '='.$this->parent->getTable().'.'.$this->foreignKey)
92 92
             ->fetchSql()
93 93
             ->$aggregate($field);
94 94
     }
@@ -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) {
147
+            ->whereExists(function($query) use ($table, $model, $relation, $localKey, $foreignKey) {
148 148
                 $query->table([$table => $relation])
149
-                    ->field($relation . '.' . $localKey)
150
-                    ->whereExp($model . '.' . $foreignKey, '=' . $relation . '.' . $localKey)
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.'.'.$localKey)
150
+                    ->whereExp($model.'.'.$foreignKey, '='.$relation.'.'.$localKey)
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->foreignKey . '=' . $relation . '.' . $this->localKey, $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->foreignKey.'='.$relation.'.'.$this->localKey, $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.