Completed
Pull Request — 6.0 (#1895)
by nhzex
04:53
created
src/think/model/relation/HasManyThrough.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -107,16 +107,16 @@  discard block
 block discarded – undo
107 107
         $relationTable = $relation->getTable();
108 108
 
109 109
         if ('*' != $id) {
110
-            $id = $relationTable . '.' . $relation->getPk();
110
+            $id = $relationTable.'.'.$relation->getPk();
111 111
         }
112 112
 
113 113
         return $this->parent->db()
114 114
             ->alias($model)
115
-            ->field($model . '.*')
116
-            ->join($throughTable, $throughTable . '.' . $this->foreignKey . '=' . $model . '.' . $this->localKey)
117
-            ->join($relationTable, $relationTable . '.' . $throughKey . '=' . $throughTable . '.' . $this->throughPk)
118
-            ->group($relationTable . '.' . $this->throughKey)
119
-            ->having('count(' . $id . ')' . $operator . $count);
115
+            ->field($model.'.*')
116
+            ->join($throughTable, $throughTable.'.'.$this->foreignKey.'='.$model.'.'.$this->localKey)
117
+            ->join($relationTable, $relationTable.'.'.$throughKey.'='.$throughTable.'.'.$this->throughPk)
118
+            ->group($relationTable.'.'.$this->throughKey)
119
+            ->having('count('.$id.')'.$operator.$count);
120 120
     }
121 121
 
122 122
     /**
@@ -145,9 +145,9 @@  discard block
 block discarded – undo
145 145
 
146 146
         return $this->parent->db()
147 147
             ->alias($model)
148
-            ->join($throughTable, $throughTable . '.' . $this->foreignKey . '=' . $model . '.' . $this->localKey)
149
-            ->join($modelTable, $modelTable . '.' . $throughKey . '=' . $throughTable . '.' . $this->throughPk)
150
-            ->group($modelTable . '.' . $this->throughKey)
148
+            ->join($throughTable, $throughTable.'.'.$this->foreignKey.'='.$model.'.'.$this->localKey)
149
+            ->join($modelTable, $modelTable.'.'.$throughKey.'='.$throughTable.'.'.$this->throughPk)
150
+            ->group($modelTable.'.'.$this->throughKey)
151 151
             ->where($where)
152 152
             ->field($fields);
153 153
     }
@@ -294,14 +294,14 @@  discard block
 block discarded – undo
294 294
         $modelTable   = $this->parent->getTable();
295 295
 
296 296
         if (false === strpos($field, '.')) {
297
-            $field = $alias . '.' . $field;
297
+            $field = $alias.'.'.$field;
298 298
         }
299 299
 
300 300
         return $this->query
301 301
             ->alias($alias)
302
-            ->join($throughTable, $throughTable . '.' . $pk . '=' . $alias . '.' . $throughKey)
303
-            ->join($modelTable, $modelTable . '.' . $this->localKey . '=' . $throughTable . '.' . $this->foreignKey)
304
-            ->where($throughTable . '.' . $this->foreignKey, $result->$localKey)
302
+            ->join($throughTable, $throughTable.'.'.$pk.'='.$alias.'.'.$throughKey)
303
+            ->join($modelTable, $modelTable.'.'.$this->localKey.'='.$throughTable.'.'.$this->foreignKey)
304
+            ->where($throughTable.'.'.$this->foreignKey, $result->$localKey)
305 305
             ->$aggregate($field);
306 306
     }
307 307
 
@@ -327,14 +327,14 @@  discard block
 block discarded – undo
327 327
         $modelTable   = $this->parent->getTable();
328 328
 
329 329
         if (false === strpos($field, '.')) {
330
-            $field = $alias . '.' . $field;
330
+            $field = $alias.'.'.$field;
331 331
         }
332 332
 
333 333
         return $this->query
334 334
             ->alias($alias)
335
-            ->join($throughTable, $throughTable . '.' . $pk . '=' . $alias . '.' . $throughKey)
336
-            ->join($modelTable, $modelTable . '.' . $this->localKey . '=' . $throughTable . '.' . $this->foreignKey)
337
-            ->whereExp($throughTable . '.' . $this->foreignKey, '=' . $this->parent->getTable() . '.' . $this->localKey)
335
+            ->join($throughTable, $throughTable.'.'.$pk.'='.$alias.'.'.$throughKey)
336
+            ->join($modelTable, $modelTable.'.'.$this->localKey.'='.$throughTable.'.'.$this->foreignKey)
337
+            ->whereExp($throughTable.'.'.$this->foreignKey, '='.$this->parent->getTable().'.'.$this->localKey)
338 338
             ->fetchSql()
339 339
             ->$aggregate($field);
340 340
     }
@@ -357,9 +357,9 @@  discard block
 block discarded – undo
357 357
             $this->query
358 358
                 ->field($fields)
359 359
                 ->alias($alias)
360
-                ->join($throughTable, $throughTable . '.' . $pk . '=' . $alias . '.' . $throughKey)
361
-                ->join($modelTable, $modelTable . '.' . $this->localKey . '=' . $throughTable . '.' . $this->foreignKey)
362
-                ->where($throughTable . '.' . $this->foreignKey, $this->parent->{$this->localKey});
360
+                ->join($throughTable, $throughTable.'.'.$pk.'='.$alias.'.'.$throughKey)
361
+                ->join($modelTable, $modelTable.'.'.$this->localKey.'='.$throughTable.'.'.$this->foreignKey)
362
+                ->where($throughTable.'.'.$this->foreignKey, $this->parent->{$this->localKey});
363 363
 
364 364
             $this->baseQuery = true;
365 365
         }
Please login to merge, or discard this patch.
src/think/model/relation/HasMany.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 // +----------------------------------------------------------------------
9 9
 // | Author: liu21st <[email protected]>
10 10
 // +----------------------------------------------------------------------
11
-declare (strict_types = 1);
11
+declare(strict_types=1);
12 12
 
13 13
 namespace think\model\relation;
14 14
 
@@ -180,8 +180,8 @@  discard block
 block discarded – undo
180 180
             $closure($this, $name);
181 181
         }
182 182
 
183
-        return $this->query->alias($aggregate . '_table')
184
-            ->whereExp($aggregate . '_table.' . $this->foreignKey, '=' . $this->parent->getTable() . '.' . $this->localKey)
183
+        return $this->query->alias($aggregate.'_table')
184
+            ->whereExp($aggregate.'_table.'.$this->foreignKey, '='.$this->parent->getTable().'.'.$this->localKey)
185 185
             ->fetchSql()
186 186
             ->$aggregate($field);
187 187
     }
@@ -290,15 +290,15 @@  discard block
 block discarded – undo
290 290
         $relation = App::classBaseName($this->model);
291 291
 
292 292
         if ('*' != $id) {
293
-            $id = $relation . '.' . (new $this->model)->getPk();
293
+            $id = $relation.'.'.(new $this->model)->getPk();
294 294
         }
295 295
 
296 296
         return $this->parent->db()
297 297
             ->alias($model)
298
-            ->field($model . '.*')
299
-            ->join([$table => $relation], $model . '.' . $this->localKey . '=' . $relation . '.' . $this->foreignKey, $joinType)
300
-            ->group($relation . '.' . $this->foreignKey)
301
-            ->having('count(' . $id . ')' . $operator . $count);
298
+            ->field($model.'.*')
299
+            ->join([$table => $relation], $model.'.'.$this->localKey.'='.$relation.'.'.$this->foreignKey, $joinType)
300
+            ->group($relation.'.'.$this->foreignKey)
301
+            ->having('count('.$id.')'.$operator.$count);
302 302
     }
303 303
 
304 304
     /**
@@ -325,9 +325,9 @@  discard block
 block discarded – undo
325 325
 
326 326
         return $this->parent->db()
327 327
             ->alias($model)
328
-            ->group($model . '.' . $this->localKey)
328
+            ->group($model.'.'.$this->localKey)
329 329
             ->field($fields)
330
-            ->join([$table => $relation], $model . '.' . $this->localKey . '=' . $relation . '.' . $this->foreignKey)
330
+            ->join([$table => $relation], $model.'.'.$this->localKey.'='.$relation.'.'.$this->foreignKey)
331 331
             ->where($where);
332 332
     }
333 333
 
Please login to merge, or discard this patch.
src/think/model/relation/BelongsTo.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 // +----------------------------------------------------------------------
9 9
 // | Author: liu21st <[email protected]>
10 10
 // +----------------------------------------------------------------------
11
-declare (strict_types = 1);
11
+declare(strict_types=1);
12 12
 
13 13
 namespace think\model\relation;
14 14
 
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
         }
90 90
 
91 91
         return $this->query
92
-            ->whereExp($this->localKey, '=' . $this->parent->getTable() . '.' . $this->foreignKey)
92
+            ->whereExp($this->localKey, '='.$this->parent->getTable().'.'.$this->foreignKey)
93 93
             ->fetchSql()
94 94
             ->$aggregate($field);
95 95
     }
@@ -140,10 +140,10 @@  discard block
 block discarded – undo
140 140
 
141 141
         return $this->parent->db()
142 142
             ->alias($model)
143
-            ->whereExists(function ($query) use ($table, $model, $relation, $localKey, $foreignKey) {
143
+            ->whereExists(function($query) use ($table, $model, $relation, $localKey, $foreignKey) {
144 144
                 $query->table([$table => $relation])
145
-                    ->field($relation . '.' . $localKey)
146
-                    ->whereExp($model . '.' . $foreignKey, '=' . $relation . '.' . $localKey);
145
+                    ->field($relation.'.'.$localKey)
146
+                    ->whereExp($model.'.'.$foreignKey, '='.$relation.'.'.$localKey);
147 147
             });
148 148
     }
149 149
 
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
         return $this->parent->db()
173 173
             ->alias($model)
174 174
             ->field($fields)
175
-            ->join([$table => $relation], $model . '.' . $this->foreignKey . '=' . $relation . '.' . $this->localKey, $joinType ?: $this->joinType)
175
+            ->join([$table => $relation], $model.'.'.$this->foreignKey.'='.$relation.'.'.$this->localKey, $joinType ?: $this->joinType)
176 176
             ->where($where);
177 177
     }
178 178
 
Please login to merge, or discard this patch.
src/think/Paginator.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 // +----------------------------------------------------------------------
9 9
 // | Author: zhangyajun <[email protected]>
10 10
 // +----------------------------------------------------------------------
11
-declare (strict_types = 1);
11
+declare(strict_types=1);
12 12
 
13 13
 namespace think;
14 14
 
@@ -184,10 +184,10 @@  discard block
 block discarded – undo
184 184
 
185 185
         $url = $path;
186 186
         if (!empty($parameters)) {
187
-            $url .= '?' . http_build_query($parameters, '', '&');
187
+            $url .= '?'.http_build_query($parameters, '', '&');
188 188
         }
189 189
 
190
-        return $url . $this->buildFragment();
190
+        return $url.$this->buildFragment();
191 191
     }
192 192
 
193 193
     /**
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
      */
337 337
     protected function buildFragment(): string
338 338
     {
339
-        return $this->options['fragment'] ? '#' . $this->options['fragment'] : '';
339
+        return $this->options['fragment'] ? '#'.$this->options['fragment'] : '';
340 340
     }
341 341
 
342 342
     /**
Please login to merge, or discard this patch.
src/think/exception/Handle.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
             }
73 73
 
74 74
             if ($this->app->config->get('log.record_trace')) {
75
-                $log .= PHP_EOL . $exception->getTraceAsString();
75
+                $log .= PHP_EOL.$exception->getTraceAsString();
76 76
             }
77 77
 
78 78
             $this->app->log->record($log, 'error');
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
 
204 204
             ob_start();
205 205
             extract($data);
206
-            include $this->app->config->get('app.exception_tmpl') ?: __DIR__ . '/../../tpl/think_exception.tpl';
206
+            include $this->app->config->get('app.exception_tmpl') ?: __DIR__.'/../../tpl/think_exception.tpl';
207 207
 
208 208
             // 获取并清空缓存
209 209
             $data     = ob_get_clean();
@@ -257,10 +257,10 @@  discard block
 block discarded – undo
257 257
 
258 258
         if (strpos($message, ':')) {
259 259
             $name    = strstr($message, ':', true);
260
-            $message = $lang->has($name) ? $lang->get($name) . strstr($message, ':') : $message;
260
+            $message = $lang->has($name) ? $lang->get($name).strstr($message, ':') : $message;
261 261
         } elseif (strpos($message, ',')) {
262 262
             $name    = strstr($message, ',', true);
263
-            $message = $lang->has($name) ? $lang->get($name) . ':' . substr(strstr($message, ','), 1) : $message;
263
+            $message = $lang->has($name) ? $lang->get($name).':'.substr(strstr($message, ','), 1) : $message;
264 264
         } elseif ($lang->has($message)) {
265 265
             $message = $lang->get($message);
266 266
         }
Please login to merge, or discard this patch.
src/think/response/Xml.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@
 block discarded – undo
48 48
             if (0 !== strpos($data, '<?xml')) {
49 49
                 $encoding = $this->options['encoding'];
50 50
                 $xml      = "<?xml version=\"1.0\" encoding=\"{$encoding}\"?>";
51
-                $data     = $xml . $data;
51
+                $data     = $xml.$data;
52 52
             }
53 53
             return $data;
54 54
         }
Please login to merge, or discard this patch.
src/think/response/Jsonp.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@
 block discarded – undo
57 57
                 throw new \InvalidArgumentException(json_last_error_msg());
58 58
             }
59 59
 
60
-            $data = $handler . '(' . $data . ');';
60
+            $data = $handler.'('.$data.');';
61 61
 
62 62
             return $data;
63 63
         } catch (\Exception $e) {
Please login to merge, or discard this patch.
src/think/response/File.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
     protected function output($data)
35 35
     {
36 36
         if (!$this->isContent && !is_file($data)) {
37
-            throw new Exception('file not exists:' . $data);
37
+            throw new Exception('file not exists:'.$data);
38 38
         }
39 39
 
40 40
         ob_end_clean();
@@ -55,13 +55,13 @@  discard block
 block discarded – undo
55 55
 
56 56
         $this->header['Pragma']                    = 'public';
57 57
         $this->header['Content-Type']              = $mimeType ?: 'application/octet-stream';
58
-        $this->header['Cache-control']             = 'max-age=' . $this->expire;
59
-        $this->header['Content-Disposition']       = 'attachment; filename="' . $name . '"';
58
+        $this->header['Cache-control']             = 'max-age='.$this->expire;
59
+        $this->header['Content-Disposition']       = 'attachment; filename="'.$name.'"';
60 60
         $this->header['Content-Length']            = $size;
61 61
         $this->header['Content-Transfer-Encoding'] = 'binary';
62
-        $this->header['Expires']                   = gmdate("D, d M Y H:i:s", time() + $this->expire) . ' GMT';
62
+        $this->header['Expires']                   = gmdate("D, d M Y H:i:s", time() + $this->expire).' GMT';
63 63
 
64
-        $this->lastModified(gmdate('D, d M Y H:i:s', time()) . ' GMT');
64
+        $this->lastModified(gmdate('D, d M Y H:i:s', time()).' GMT');
65 65
 
66 66
         return $this->isContent ? $data : file_get_contents($data);
67 67
     }
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
         $this->name = $filename;
132 132
 
133 133
         if ($extension && false === strpos($filename, '.')) {
134
-            $this->name .= '.' . pathinfo($this->data, PATHINFO_EXTENSION);
134
+            $this->name .= '.'.pathinfo($this->data, PATHINFO_EXTENSION);
135 135
         }
136 136
 
137 137
         return $this;
Please login to merge, or discard this patch.
src/think/initializer/Error.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
 // +----------------------------------------------------------------------
9 9
 // | Author: 麦当苗儿 <[email protected]> <http://zjzit.cn>
10 10
 // +----------------------------------------------------------------------
11
-declare (strict_types = 1);
11
+declare(strict_types=1);
12 12
 
13 13
 namespace think\initializer;
14 14
 
Please login to merge, or discard this patch.