Passed
Pull Request — 5.1 (#2092)
by
unknown
08:51
created
library/think/model/relation/OneToOne.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -83,9 +83,9 @@  discard block
 block discarded – undo
83 83
         $query->via($joinAlias);
84 84
 
85 85
         if ($this instanceof BelongsTo) {
86
-            $joinOn = $name . '.' . $this->foreignKey . '=' . $joinAlias . '.' . $this->localKey;
86
+            $joinOn = $name.'.'.$this->foreignKey.'='.$joinAlias.'.'.$this->localKey;
87 87
         } else {
88
-            $joinOn = $name . '.' . $this->localKey . '=' . $joinAlias . '.' . $this->foreignKey;
88
+            $joinOn = $name.'.'.$this->localKey.'='.$joinAlias.'.'.$this->foreignKey;
89 89
         }
90 90
 
91 91
         if ($closure instanceof Closure) {
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
         }
101 101
 
102 102
         $query->join([$joinTable => $joinAlias], $joinOn, $joinType)
103
-            ->field($field, false, $joinTable, $joinAlias, $relation . '__');
103
+            ->field($field, false, $joinTable, $joinAlias, $relation.'__');
104 104
     }
105 105
 
106 106
     /**
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
         foreach ($this->bindAttr as $key => $attr) {
293 293
             $key = is_numeric($key) ? $attr : $key;
294 294
             if (isset($result->$key)) {
295
-                throw new Exception('bind attr has exists:' . $key);
295
+                throw new Exception('bind attr has exists:'.$key);
296 296
             } else {
297 297
                 $result->setAttr($key, $model ? $model->$attr : null);
298 298
             }
Please login to merge, or discard this patch.
library/think/session/driver/Redis.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
      */
96 96
     public function read($sessID)
97 97
     {
98
-        return (string) $this->handler->get($this->config['session_name'] . $sessID);
98
+        return (string) $this->handler->get($this->config['session_name'].$sessID);
99 99
     }
100 100
 
101 101
     /**
@@ -108,9 +108,9 @@  discard block
 block discarded – undo
108 108
     public function write($sessID, $sessData)
109 109
     {
110 110
         if ($this->config['expire'] > 0) {
111
-            $result = $this->handler->setex($this->config['session_name'] . $sessID, $this->config['expire'], $sessData);
111
+            $result = $this->handler->setex($this->config['session_name'].$sessID, $this->config['expire'], $sessData);
112 112
         } else {
113
-            $result = $this->handler->set($this->config['session_name'] . $sessID, $sessData);
113
+            $result = $this->handler->set($this->config['session_name'].$sessID, $sessData);
114 114
         }
115 115
 
116 116
         return $result ? true : false;
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
      */
125 125
     public function destroy($sessID)
126 126
     {
127
-        return $this->handler->del($this->config['session_name'] . $sessID) > 0;
127
+        return $this->handler->del($this->config['session_name'].$sessID) > 0;
128 128
     }
129 129
 
130 130
     /**
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
             $this->open('', '');
152 152
         }
153 153
 
154
-        $lockKey = 'LOCK_PREFIX_' . $sessID;
154
+        $lockKey = 'LOCK_PREFIX_'.$sessID;
155 155
         // 使用setnx操作加锁
156 156
         $isLock = $this->handler->setnx($lockKey, 1);
157 157
         if ($isLock) {
@@ -174,6 +174,6 @@  discard block
 block discarded – undo
174 174
             $this->open('', '');
175 175
         }
176 176
 
177
-        $this->handler->del('LOCK_PREFIX_' . $sessID);
177
+        $this->handler->del('LOCK_PREFIX_'.$sessID);
178 178
     }
179 179
 }
Please login to merge, or discard this patch.
library/think/db/Builder.php 1 patch
Spacing   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -132,23 +132,23 @@  discard block
 block discarded – undo
132 132
             if (false !== strpos($key, '->')) {
133 133
                 list($key, $name) = explode('->', $key);
134 134
                 $item             = $this->parseKey($query, $key);
135
-                $result[$item]    = 'json_set(' . $item . ', \'$.' . $name . '\', ' . $this->parseDataBind($query, $key, $val, $bind) . ')';
135
+                $result[$item]    = 'json_set('.$item.', \'$.'.$name.'\', '.$this->parseDataBind($query, $key, $val, $bind).')';
136 136
             } elseif ('*' == $options['field'] && false === strpos($key, '.') && !in_array($key, $fields, true)) {
137 137
                 if ($options['strict']) {
138
-                    throw new Exception('fields not exists:[' . $key . ']');
138
+                    throw new Exception('fields not exists:['.$key.']');
139 139
                 }
140 140
             } elseif (is_null($val)) {
141 141
                 $result[$item] = 'NULL';
142 142
             } elseif (is_array($val) && !empty($val)) {
143 143
                 switch (strtoupper($val[0])) {
144 144
                     case 'INC':
145
-                        $result[$item] = $item . ' + ' . floatval($val[1]);
145
+                        $result[$item] = $item.' + '.floatval($val[1]);
146 146
                         break;
147 147
                     case 'DEC':
148
-                        $result[$item] = $item . ' - ' . floatval($val[1]);
148
+                        $result[$item] = $item.' - '.floatval($val[1]);
149 149
                         break;
150 150
                     case 'EXP':
151
-                        throw new Exception('not support data:[' . $val[0] . ']');
151
+                        throw new Exception('not support data:['.$val[0].']');
152 152
                 }
153 153
             } elseif (is_scalar($val)) {
154 154
                 // 过滤非标量数据
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 
177 177
         $name = $query->bind($data, isset($bind[$key]) ? $bind[$key] : PDO::PARAM_STR);
178 178
 
179
-        return ':' . $name;
179
+        return ':'.$name;
180 180
     }
181 181
 
182 182
     /**
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 
210 210
             foreach ($fields as $key => $field) {
211 211
                 if (!is_numeric($key)) {
212
-                    $array[] = $this->parseKey($query, $key) . ' AS ' . $this->parseKey($query, $field, true);
212
+                    $array[] = $this->parseKey($query, $key).' AS '.$this->parseKey($query, $field, true);
213 213
                 } else {
214 214
                     $array[] = $this->parseKey($query, $field);
215 215
                 }
@@ -236,12 +236,12 @@  discard block
 block discarded – undo
236 236
         foreach ((array) $tables as $key => $table) {
237 237
             if (!is_numeric($key)) {
238 238
                 $key    = $this->connection->parseSqlTable($key);
239
-                $item[] = $this->parseKey($query, $key) . ' ' . $this->parseKey($query, $table);
239
+                $item[] = $this->parseKey($query, $key).' '.$this->parseKey($query, $table);
240 240
             } else {
241 241
                 $table = $this->connection->parseSqlTable($table);
242 242
 
243 243
                 if (isset($options['alias'][$table])) {
244
-                    $item[] = $this->parseKey($query, $table) . ' ' . $this->parseKey($query, $options['alias'][$table]);
244
+                    $item[] = $this->parseKey($query, $table).' '.$this->parseKey($query, $options['alias'][$table]);
245 245
                 } else {
246 246
                     $item[] = $this->parseKey($query, $table);
247 247
                 }
@@ -268,11 +268,11 @@  discard block
 block discarded – undo
268 268
             list($field, $condition) = $options['soft_delete'];
269 269
 
270 270
             $binds    = $this->connection->getFieldsBind($options['table']);
271
-            $whereStr = $whereStr ? '( ' . $whereStr . ' ) AND ' : '';
272
-            $whereStr = $whereStr . $this->parseWhereItem($query, $field, $condition, '', $binds);
271
+            $whereStr = $whereStr ? '( '.$whereStr.' ) AND ' : '';
272
+            $whereStr = $whereStr.$this->parseWhereItem($query, $field, $condition, '', $binds);
273 273
         }
274 274
 
275
-        return empty($whereStr) ? '' : ' WHERE ' . $whereStr;
275
+        return empty($whereStr) ? '' : ' WHERE '.$whereStr;
276 276
     }
277 277
 
278 278
     /**
@@ -296,17 +296,17 @@  discard block
 block discarded – undo
296 296
 
297 297
             foreach ($val as $value) {
298 298
                 if ($value instanceof Expression) {
299
-                    $str[] = ' ' . $logic . ' ( ' . $value->getValue() . ' )';
299
+                    $str[] = ' '.$logic.' ( '.$value->getValue().' )';
300 300
                     continue;
301 301
                 }
302 302
 
303 303
                 if (is_array($value)) {
304 304
                     if (key($value) !== 0) {
305
-                        throw new Exception('where express error:' . var_export($value, true));
305
+                        throw new Exception('where express error:'.var_export($value, true));
306 306
                     }
307 307
                     $field = array_shift($value);
308 308
                 } elseif (!($value instanceof \Closure)) {
309
-                    throw new Exception('where express error:' . var_export($value, true));
309
+                    throw new Exception('where express error:'.var_export($value, true));
310 310
                 }
311 311
 
312 312
                 if ($value instanceof \Closure) {
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
 
318 318
                     if (!empty($whereClause)) {
319 319
                         $query->bind($newQuery->getBind(false));
320
-                        $str[] = ' ' . $logic . ' ( ' . $whereClause . ' )';
320
+                        $str[] = ' '.$logic.' ( '.$whereClause.' )';
321 321
                     }
322 322
                 } elseif (is_array($field)) {
323 323
                     array_unshift($value, $field);
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
                         $str2[] = $this->parseWhereItem($query, array_shift($item), $item, $logic, $binds);
327 327
                     }
328 328
 
329
-                    $str[] = ' ' . $logic . ' ( ' . implode(' AND ', $str2) . ' )';
329
+                    $str[] = ' '.$logic.' ( '.implode(' AND ', $str2).' )';
330 330
                 } elseif (strpos($field, '|')) {
331 331
                     // 不同字段使用相同查询条件(OR)
332 332
                     $array = explode('|', $field);
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
                         $item[] = $this->parseWhereItem($query, $k, $value, '', $binds);
337 337
                     }
338 338
 
339
-                    $str[] = ' ' . $logic . ' ( ' . implode(' OR ', $item) . ' )';
339
+                    $str[] = ' '.$logic.' ( '.implode(' OR ', $item).' )';
340 340
                 } elseif (strpos($field, '&')) {
341 341
                     // 不同字段使用相同查询条件(AND)
342 342
                     $array = explode('&', $field);
@@ -346,11 +346,11 @@  discard block
 block discarded – undo
346 346
                         $item[] = $this->parseWhereItem($query, $k, $value, '', $binds);
347 347
                     }
348 348
 
349
-                    $str[] = ' ' . $logic . ' ( ' . implode(' AND ', $item) . ' )';
349
+                    $str[] = ' '.$logic.' ( '.implode(' AND ', $item).' )';
350 350
                 } else {
351 351
                     // 对字段使用表达式查询
352 352
                     $field = is_string($field) ? $field : '';
353
-                    $str[] = ' ' . $logic . ' ' . $this->parseWhereItem($query, $field, $value, $logic, $binds);
353
+                    $str[] = ' '.$logic.' '.$this->parseWhereItem($query, $field, $value, $logic, $binds);
354 354
                 }
355 355
             }
356 356
 
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
                 $str[] = $this->parseWhereItem($query, $field, $item, $rule, $binds);
389 389
             }
390 390
 
391
-            return '( ' . implode(' ' . $rule . ' ', $str) . ' )';
391
+            return '( '.implode(' '.$rule.' ', $str).' )';
392 392
         }
393 393
 
394 394
         // 检测操作符
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
             if (0 === strpos($value, ':') && $query->isBind(substr($value, 1))) {
416 416
             } else {
417 417
                 $name  = $query->bind($value, $bindType);
418
-                $value = ':' . $name;
418
+                $value = ':'.$name;
419 419
             }
420 420
         }
421 421
 
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
         }
429 429
 
430 430
         if (!isset($whereStr)) {
431
-            throw new Exception('where express error:' . $exp);
431
+            throw new Exception('where express error:'.$exp);
432 432
         }
433 433
 
434 434
         return $whereStr;
@@ -452,12 +452,12 @@  discard block
 block discarded – undo
452 452
         if (is_array($value)) {
453 453
             foreach ($value as $item) {
454 454
                 $name    = $query->bind($item, PDO::PARAM_STR);
455
-                $array[] = $key . ' ' . $exp . ' :' . $name;
455
+                $array[] = $key.' '.$exp.' :'.$name;
456 456
             }
457 457
 
458
-            $whereStr = '(' . implode(' ' . strtoupper($logic) . ' ', $array) . ')';
458
+            $whereStr = '('.implode(' '.strtoupper($logic).' ', $array).')';
459 459
         } else {
460
-            $whereStr = $key . ' ' . $exp . ' ' . $value;
460
+            $whereStr = $key.' '.$exp.' '.$value;
461 461
         }
462 462
 
463 463
         return $whereStr;
@@ -480,10 +480,10 @@  discard block
 block discarded – undo
480 480
         list($op, $field2) = $value;
481 481
 
482 482
         if (!in_array($op, ['=', '<>', '>', '>=', '<', '<='])) {
483
-            throw new Exception('where express error:' . var_export($value, true));
483
+            throw new Exception('where express error:'.var_export($value, true));
484 484
         }
485 485
 
486
-        return '( ' . $key . ' ' . $op . ' ' . $this->parseKey($query, $field2, true) . ' )';
486
+        return '( '.$key.' '.$op.' '.$this->parseKey($query, $field2, true).' )';
487 487
     }
488 488
 
489 489
     /**
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
     protected function parseExp(Query $query, $key, $exp, Expression $value, $field, $bindType)
501 501
     {
502 502
         // 表达式查询
503
-        return '( ' . $key . ' ' . $value->getValue() . ' )';
503
+        return '( '.$key.' '.$value->getValue().' )';
504 504
     }
505 505
 
506 506
     /**
@@ -517,7 +517,7 @@  discard block
 block discarded – undo
517 517
     protected function parseNull(Query $query, $key, $exp, $value, $field, $bindType)
518 518
     {
519 519
         // NULL 查询
520
-        return $key . ' IS ' . $exp;
520
+        return $key.' IS '.$exp;
521 521
     }
522 522
 
523 523
     /**
@@ -539,7 +539,7 @@  discard block
 block discarded – undo
539 539
         $min = $query->bind($data[0], $bindType);
540 540
         $max = $query->bind($data[1], $bindType);
541 541
 
542
-        return $key . ' ' . $exp . ' :' . $min . ' AND :' . $max . ' ';
542
+        return $key.' '.$exp.' :'.$min.' AND :'.$max.' ';
543 543
     }
544 544
 
545 545
     /**
@@ -561,10 +561,10 @@  discard block
 block discarded – undo
561 561
         } elseif ($value instanceof Expression) {
562 562
             $value = $value->getValue();
563 563
         } else {
564
-            throw new Exception('where express error:' . $value);
564
+            throw new Exception('where express error:'.$value);
565 565
         }
566 566
 
567
-        return $exp . ' (' . $value . ')';
567
+        return $exp.' ('.$value.')';
568 568
     }
569 569
 
570 570
     /**
@@ -580,7 +580,7 @@  discard block
 block discarded – undo
580 580
      */
581 581
     protected function parseTime(Query $query, $key, $exp, $value, $field, $bindType)
582 582
     {
583
-        return $key . ' ' . substr($exp, 0, 2) . ' ' . $this->parseDateTime($query, $value, $field, $bindType);
583
+        return $key.' '.substr($exp, 0, 2).' '.$this->parseDateTime($query, $value, $field, $bindType);
584 584
     }
585 585
 
586 586
     /**
@@ -597,7 +597,7 @@  discard block
 block discarded – undo
597 597
     protected function parseCompare(Query $query, $key, $exp, $value, $field, $bindType)
598 598
     {
599 599
         if (is_array($value)) {
600
-            throw new Exception('where express error:' . $exp . var_export($value, true));
600
+            throw new Exception('where express error:'.$exp.var_export($value, true));
601 601
         }
602 602
 
603 603
         // 比较运算
@@ -606,10 +606,10 @@  discard block
 block discarded – undo
606 606
         }
607 607
 
608 608
         if ('=' == $exp && is_null($value)) {
609
-            return $key . ' IS NULL';
609
+            return $key.' IS NULL';
610 610
         }
611 611
 
612
-        return $key . ' ' . $exp . ' ' . $value;
612
+        return $key.' '.$exp.' '.$value;
613 613
     }
614 614
 
615 615
     /**
@@ -629,7 +629,7 @@  discard block
 block discarded – undo
629 629
             $value = explode(',', $value);
630 630
         }
631 631
 
632
-        return $key . ' ' . substr($exp, 0, -4)
632
+        return $key.' '.substr($exp, 0, -4)
633 633
         . $this->parseDateTime($query, $value[0], $field, $bindType)
634 634
         . ' AND '
635 635
         . $this->parseDateTime($query, $value[1], $field, $bindType);
@@ -660,18 +660,18 @@  discard block
 block discarded – undo
660 660
 
661 661
             foreach ($value as $k => $v) {
662 662
                 $name    = $query->bind($v, $bindType);
663
-                $array[] = ':' . $name;
663
+                $array[] = ':'.$name;
664 664
             }
665 665
 
666 666
             if (count($array) == 1) {
667
-                return $key . ('IN' == $exp ? ' = ' : ' <> ') . $array[0];
667
+                return $key.('IN' == $exp ? ' = ' : ' <> ').$array[0];
668 668
             } else {
669 669
                 $zone  = implode(',', $array);
670 670
                 $value = empty($zone) ? "''" : $zone;
671 671
             }
672 672
         }
673 673
 
674
-        return $key . ' ' . $exp . ' (' . $value . ')';
674
+        return $key.' '.$exp.' ('.$value.')';
675 675
     }
676 676
 
677 677
     /**
@@ -736,7 +736,7 @@  discard block
 block discarded – undo
736 736
 
737 737
         $name = $query->bind($value, $bindType);
738 738
 
739
-        return ':' . $name;
739
+        return ':'.$name;
740 740
     }
741 741
 
742 742
     /**
@@ -748,7 +748,7 @@  discard block
 block discarded – undo
748 748
      */
749 749
     protected function parseLimit(Query $query, $limit)
750 750
     {
751
-        return (!empty($limit) && false === strpos($limit, '(')) ? ' LIMIT ' . $limit . ' ' : '';
751
+        return (!empty($limit) && false === strpos($limit, '(')) ? ' LIMIT '.$limit.' ' : '';
752 752
     }
753 753
 
754 754
     /**
@@ -774,7 +774,7 @@  discard block
 block discarded – undo
774 774
                     } elseif (strpos($val, '=')) {
775 775
                         list($val1, $val2) = explode('=', $val, 2);
776 776
 
777
-                        $condition[] = $this->parseKey($query, $val1) . '=' . $this->parseKey($query, $val2);
777
+                        $condition[] = $this->parseKey($query, $val1).'='.$this->parseKey($query, $val2);
778 778
                     } else {
779 779
                         $condition[] = $val;
780 780
                     }
@@ -782,7 +782,7 @@  discard block
 block discarded – undo
782 782
 
783 783
                 $table = $this->parseTable($query, $table);
784 784
 
785
-                $joinStr .= ' ' . $type . ' JOIN ' . $table . ' ON ' . implode(' AND ', $condition);
785
+                $joinStr .= ' '.$type.' JOIN '.$table.' ON '.implode(' AND ', $condition);
786 786
             }
787 787
         }
788 788
 
@@ -807,22 +807,22 @@  discard block
 block discarded – undo
807 807
                 $array[] = $this->parseRand($query);
808 808
             } elseif (is_string($val)) {
809 809
                 if (is_numeric($key)) {
810
-                    list($key, $sort) = explode(' ', strpos($val, ' ') ? $val : $val . ' ');
810
+                    list($key, $sort) = explode(' ', strpos($val, ' ') ? $val : $val.' ');
811 811
                 } else {
812 812
                     $sort = $val;
813 813
                 }
814 814
 
815 815
                 if (preg_match('/^[\w\.]+$/', $key)) {
816 816
                     $sort    = strtoupper($sort);
817
-                    $sort    = in_array($sort, ['ASC', 'DESC'], true) ? ' ' . $sort : '';
818
-                    $array[] = $this->parseKey($query, $key, true) . $sort;
817
+                    $sort    = in_array($sort, ['ASC', 'DESC'], true) ? ' '.$sort : '';
818
+                    $array[] = $this->parseKey($query, $key, true).$sort;
819 819
                 } else {
820
-                    throw new Exception('order express error:' . $key);
820
+                    throw new Exception('order express error:'.$key);
821 821
                 }
822 822
             }
823 823
         }
824 824
 
825
-        return empty($array) ? '' : ' ORDER BY ' . implode(',', $array);
825
+        return empty($array) ? '' : ' ORDER BY '.implode(',', $array);
826 826
     }
827 827
 
828 828
     /**
@@ -843,7 +843,7 @@  discard block
 block discarded – undo
843 843
         }
844 844
 
845 845
         $sort = strtoupper($sort);
846
-        $sort = in_array($sort, ['ASC', 'DESC'], true) ? ' ' . $sort : '';
846
+        $sort = in_array($sort, ['ASC', 'DESC'], true) ? ' '.$sort : '';
847 847
 
848 848
         $options = $query->getOptions();
849 849
         $bind    = $this->connection->getFieldsBind($options['table']);
@@ -852,7 +852,7 @@  discard block
 block discarded – undo
852 852
             $val[$k] = $this->parseDataBind($query, $key, $item, $bind);
853 853
         }
854 854
 
855
-        return 'field(' . $this->parseKey($query, $key, true) . ',' . implode(',', $val) . ')' . $sort;
855
+        return 'field('.$this->parseKey($query, $key, true).','.implode(',', $val).')'.$sort;
856 856
     }
857 857
 
858 858
     /**
@@ -876,7 +876,7 @@  discard block
 block discarded – undo
876 876
             $val[] = $this->parseKey($query, $key);
877 877
         }
878 878
 
879
-        return ' GROUP BY ' . implode(',', $val);
879
+        return ' GROUP BY '.implode(',', $val);
880 880
     }
881 881
 
882 882
     /**
@@ -888,7 +888,7 @@  discard block
 block discarded – undo
888 888
      */
889 889
     protected function parseHaving(Query $query, $having)
890 890
     {
891
-        return !empty($having) ? ' HAVING ' . $having : '';
891
+        return !empty($having) ? ' HAVING '.$having : '';
892 892
     }
893 893
 
894 894
     /**
@@ -904,7 +904,7 @@  discard block
 block discarded – undo
904 904
             $comment = strstr($comment, '*/', true);
905 905
         }
906 906
 
907
-        return !empty($comment) ? ' /* ' . $comment . ' */' : '';
907
+        return !empty($comment) ? ' /* '.$comment.' */' : '';
908 908
     }
909 909
 
910 910
     /**
@@ -937,13 +937,13 @@  discard block
 block discarded – undo
937 937
 
938 938
         foreach ($union as $u) {
939 939
             if ($u instanceof \Closure) {
940
-                $sql[] = $type . ' ' . $this->parseClosure($query, $u);
940
+                $sql[] = $type.' '.$this->parseClosure($query, $u);
941 941
             } elseif (is_string($u)) {
942
-                $sql[] = $type . ' ( ' . $this->connection->parseSqlTable($u) . ' )';
942
+                $sql[] = $type.' ( '.$this->connection->parseSqlTable($u).' )';
943 943
             }
944 944
         }
945 945
 
946
-        return ' ' . implode(' ', $sql);
946
+        return ' '.implode(' ', $sql);
947 947
     }
948 948
 
949 949
     /**
@@ -974,7 +974,7 @@  discard block
 block discarded – undo
974 974
         if (is_bool($lock)) {
975 975
             return $lock ? ' FOR UPDATE ' : '';
976 976
         } elseif (is_string($lock) && !empty($lock)) {
977
-            return ' ' . trim($lock) . ' ';
977
+            return ' '.trim($lock).' ';
978 978
         }
979 979
     }
980 980
 
@@ -1065,7 +1065,7 @@  discard block
 block discarded – undo
1065 1065
         foreach ($dataSet as $data) {
1066 1066
             $data = $this->parseData($query, $data, $allowFields, $bind);
1067 1067
 
1068
-            $values[] = 'SELECT ' . implode(',', array_values($data));
1068
+            $values[] = 'SELECT '.implode(',', array_values($data));
1069 1069
 
1070 1070
             if (!isset($insertFields)) {
1071 1071
                 $insertFields = array_keys($data);
@@ -1108,7 +1108,7 @@  discard block
 block discarded – undo
1108 1108
             $field = $this->parseKey($query, $field, true);
1109 1109
         }
1110 1110
 
1111
-        return 'INSERT INTO ' . $this->parseTable($query, $table) . ' (' . implode(',', $fields) . ') ' . $this->select($query);
1111
+        return 'INSERT INTO '.$this->parseTable($query, $table).' ('.implode(',', $fields).') '.$this->select($query);
1112 1112
     }
1113 1113
 
1114 1114
     /**
@@ -1128,7 +1128,7 @@  discard block
 block discarded – undo
1128 1128
         }
1129 1129
 
1130 1130
         foreach ($data as $key => $val) {
1131
-            $set[] = $key . ' = ' . $val;
1131
+            $set[] = $key.' = '.$val;
1132 1132
         }
1133 1133
 
1134 1134
         return str_replace(
@@ -1160,7 +1160,7 @@  discard block
 block discarded – undo
1160 1160
             ['%TABLE%', '%USING%', '%JOIN%', '%WHERE%', '%ORDER%', '%LIMIT%', '%LOCK%', '%COMMENT%'],
1161 1161
             [
1162 1162
                 $this->parseTable($query, $options['table']),
1163
-                !empty($options['using']) ? ' USING ' . $this->parseTable($query, $options['using']) . ' ' : '',
1163
+                !empty($options['using']) ? ' USING '.$this->parseTable($query, $options['using']).' ' : '',
1164 1164
                 $this->parseJoin($query, $options['join']),
1165 1165
                 $this->parseWhere($query, $options['where']),
1166 1166
                 $this->parseOrder($query, $options['order']),
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
@@ -181,15 +181,15 @@  discard block
 block discarded – undo
181 181
             $name = Loader::parseName(substr($method, 5));
182 182
             array_unshift($args, $name);
183 183
             return call_user_func_array([$this, 'where'], $args);
184
-        } elseif ($this->model && method_exists($this->model, 'scope' . $method)) {
184
+        } elseif ($this->model && method_exists($this->model, 'scope'.$method)) {
185 185
             // 动态调用命名范围
186
-            $method = 'scope' . $method;
186
+            $method = 'scope'.$method;
187 187
             array_unshift($args, $this);
188 188
 
189 189
             call_user_func_array([$this->model, $method], $args);
190 190
             return $this;
191 191
         } else {
192
-            throw new Exception('method not exist:' . ($this->model ? get_class($this->model) : static::class) . '->' . $method);
192
+            throw new Exception('method not exist:'.($this->model ? get_class($this->model) : static::class).'->'.$method);
193 193
         }
194 194
     }
195 195
 
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
 
309 309
         $name = $name ?: $this->name;
310 310
 
311
-        return $this->prefix . Loader::parseName($name);
311
+        return $this->prefix.Loader::parseName($name);
312 312
     }
313 313
 
314 314
     /**
@@ -580,16 +580,16 @@  discard block
 block discarded – undo
580 580
                         $seq = (ord($value{0}) % $rule['num']) + 1;
581 581
                     }
582 582
             }
583
-            return $this->getTable() . '_' . $seq;
583
+            return $this->getTable().'_'.$seq;
584 584
         }
585 585
         // 当设置的分表字段不在查询条件或者数据中
586 586
         // 进行联合查询,必须设定 partition['num']
587 587
         $tableName = [];
588 588
         for ($i = 0; $i < $rule['num']; $i++) {
589
-            $tableName[] = 'SELECT * FROM ' . $this->getTable() . '_' . ($i + 1);
589
+            $tableName[] = 'SELECT * FROM '.$this->getTable().'_'.($i + 1);
590 590
         }
591 591
 
592
-        return ['( ' . implode(" UNION ", $tableName) . ' )' => $this->name];
592
+        return ['( '.implode(" UNION ", $tableName).' )' => $this->name];
593 593
     }
594 594
 
595 595
     /**
@@ -655,7 +655,7 @@  discard block
 block discarded – undo
655 655
             // 支持GROUP
656 656
             $options = $this->getOptions();
657 657
             $subSql  = $this->options($options)
658
-                ->field('count(' . $field . ') AS think_count')
658
+                ->field('count('.$field.') AS think_count')
659 659
                 ->bind($this->bind)
660 660
                 ->buildSql();
661 661
 
@@ -758,7 +758,7 @@  discard block
 block discarded – undo
758 758
 
759 759
         if ($lazyTime > 0) {
760 760
             // 延迟写入
761
-            $guid = md5($this->getTable() . '_' . $field . '_' . serialize($condition));
761
+            $guid = md5($this->getTable().'_'.$field.'_'.serialize($condition));
762 762
             $step = $this->lazyWrite('inc', $guid, $step, $lazyTime);
763 763
 
764 764
             if (false === $step) {
@@ -791,7 +791,7 @@  discard block
 block discarded – undo
791 791
 
792 792
         if ($lazyTime > 0) {
793 793
             // 延迟写入
794
-            $guid = md5($this->getTable() . '_' . $field . '_' . serialize($condition));
794
+            $guid = md5($this->getTable().'_'.$field.'_'.serialize($condition));
795 795
             $step = $this->lazyWrite('dec', $guid, $step, $lazyTime);
796 796
 
797 797
             if (false === $step) {
@@ -822,15 +822,15 @@  discard block
 block discarded – undo
822 822
     {
823 823
         $cache = Container::get('cache');
824 824
 
825
-        if (!$cache->has($guid . '_time')) {
825
+        if (!$cache->has($guid.'_time')) {
826 826
             // 计时开始
827
-            $cache->set($guid . '_time', time(), 0);
827
+            $cache->set($guid.'_time', time(), 0);
828 828
             $cache->$type($guid, $step);
829
-        } elseif (time() > $cache->get($guid . '_time') + $lazyTime) {
829
+        } elseif (time() > $cache->get($guid.'_time') + $lazyTime) {
830 830
             // 删除缓存
831 831
             $value = $cache->$type($guid, $step);
832 832
             $cache->rm($guid);
833
-            $cache->rm($guid . '_time');
833
+            $cache->rm($guid.'_time');
834 834
             return 0 === $value ? false : $value;
835 835
         } else {
836 836
             // 更新缓存
@@ -1029,10 +1029,10 @@  discard block
 block discarded – undo
1029 1029
             $prefix = $prefix ?: $tableName;
1030 1030
             foreach ($field as $key => &$val) {
1031 1031
                 if (is_numeric($key) && $alias) {
1032
-                    $field[$prefix . '.' . $val] = $alias . $val;
1032
+                    $field[$prefix.'.'.$val] = $alias.$val;
1033 1033
                     unset($field[$key]);
1034 1034
                 } elseif (is_numeric($key)) {
1035
-                    $val = $prefix . '.' . $val;
1035
+                    $val = $prefix.'.'.$val;
1036 1036
                 }
1037 1037
             }
1038 1038
         }
@@ -1159,7 +1159,7 @@  discard block
 block discarded – undo
1159 1159
             $table  = $this->getJoinTable($join, $alias);
1160 1160
 
1161 1161
             if (true === $field) {
1162
-                $fields = $alias . '.*';
1162
+                $fields = $alias.'.*';
1163 1163
             } else {
1164 1164
                 if (is_string($field)) {
1165 1165
                     $field = explode(',', $field);
@@ -1167,17 +1167,17 @@  discard block
 block discarded – undo
1167 1167
 
1168 1168
                 foreach ($field as $key => $val) {
1169 1169
                     if (is_numeric($key)) {
1170
-                        $fields[] = $alias . '.' . $val;
1170
+                        $fields[] = $alias.'.'.$val;
1171 1171
 
1172
-                        $this->options['map'][$val] = $alias . '.' . $val;
1172
+                        $this->options['map'][$val] = $alias.'.'.$val;
1173 1173
                     } else {
1174 1174
                         if (preg_match('/[,=\.\'\"\(\s]/', $key)) {
1175 1175
                             $name = $key;
1176 1176
                         } else {
1177
-                            $name = $alias . '.' . $key;
1177
+                            $name = $alias.'.'.$key;
1178 1178
                         }
1179 1179
 
1180
-                        $fields[] = $name . ' AS ' . $val;
1180
+                        $fields[] = $name.' AS '.$val;
1181 1181
 
1182 1182
                         $this->options['map'][$val] = $name;
1183 1183
                     }
@@ -1490,9 +1490,9 @@  discard block
 block discarded – undo
1490 1490
             }
1491 1491
 
1492 1492
             if (is_numeric($key)) {
1493
-                $sql = substr_replace($sql, ':' . $name, strpos($sql, '?'), 1);
1493
+                $sql = substr_replace($sql, ':'.$name, strpos($sql, '?'), 1);
1494 1494
             } else {
1495
-                $sql = str_replace(':' . $key, ':' . $name, $sql);
1495
+                $sql = str_replace(':'.$key, ':'.$name, $sql);
1496 1496
             }
1497 1497
         }
1498 1498
     }
@@ -1536,7 +1536,7 @@  discard block
 block discarded – undo
1536 1536
         }
1537 1537
 
1538 1538
         if (is_string($field) && !empty($this->options['via']) && false === strpos($field, '.')) {
1539
-            $field = $this->options['via'] . '.' . $field;
1539
+            $field = $this->options['via'].'.'.$field;
1540 1540
         }
1541 1541
 
1542 1542
         if ($field instanceof Expression) {
@@ -1720,7 +1720,7 @@  discard block
 block discarded – undo
1720 1720
             list($offset, $length) = explode(',', $offset);
1721 1721
         }
1722 1722
 
1723
-        $this->options['limit'] = intval($offset) . ($length ? ',' . intval($length) : '');
1723
+        $this->options['limit'] = intval($offset).($length ? ','.intval($length) : '');
1724 1724
 
1725 1725
         return $this;
1726 1726
     }
@@ -1777,7 +1777,7 @@  discard block
 block discarded – undo
1777 1777
         }
1778 1778
 
1779 1779
         /** @var Paginator $class */
1780
-        $class = false !== strpos($config['type'], '\\') ? $config['type'] : '\\think\\paginator\\driver\\' . ucwords($config['type']);
1780
+        $class = false !== strpos($config['type'], '\\') ? $config['type'] : '\\think\\paginator\\driver\\'.ucwords($config['type']);
1781 1781
         $page  = isset($config['page']) ? (int) $config['page'] : call_user_func([
1782 1782
             $class,
1783 1783
             'getCurrentPage',
@@ -1887,7 +1887,7 @@  discard block
 block discarded – undo
1887 1887
 
1888 1888
         if (is_string($field)) {
1889 1889
             if (!empty($this->options['via'])) {
1890
-                $field = $this->options['via'] . '.' . $field;
1890
+                $field = $this->options['via'].'.'.$field;
1891 1891
             }
1892 1892
 
1893 1893
             if (strpos($field, ',')) {
@@ -1898,9 +1898,9 @@  discard block
 block discarded – undo
1898 1898
         } elseif (!empty($this->options['via'])) {
1899 1899
             foreach ($field as $key => $val) {
1900 1900
                 if (is_numeric($key)) {
1901
-                    $field[$key] = $this->options['via'] . '.' . $val;
1901
+                    $field[$key] = $this->options['via'].'.'.$val;
1902 1902
                 } else {
1903
-                    $field[$this->options['via'] . '.' . $key] = $val;
1903
+                    $field[$this->options['via'].'.'.$key] = $val;
1904 1904
                     unset($field[$key]);
1905 1905
                 }
1906 1906
             }
@@ -2312,7 +2312,7 @@  discard block
 block discarded – undo
2312 2312
         if ($this->model) {
2313 2313
             // 检查模型类的查询范围方法
2314 2314
             foreach ($scope as $name) {
2315
-                $method = 'scope' . trim($name);
2315
+                $method = 'scope'.trim($name);
2316 2316
 
2317 2317
                 if (method_exists($this->model, $method)) {
2318 2318
                     call_user_func_array([$this->model, $method], $args);
@@ -2339,7 +2339,7 @@  discard block
 block discarded – undo
2339 2339
             } elseif ($this->model) {
2340 2340
                 // 检测搜索器
2341 2341
                 $fieldName = is_numeric($key) ? $field : $key;
2342
-                $method    = 'search' . Loader::parseName($fieldName, 1) . 'Attr';
2342
+                $method    = 'search'.Loader::parseName($fieldName, 1).'Attr';
2343 2343
 
2344 2344
                 if (method_exists($this->model, $method)) {
2345 2345
                     $this->model->$method($this, isset($data[$field]) ? $data[$field] : null, $data, $prefix);
@@ -2404,7 +2404,7 @@  discard block
 block discarded – undo
2404 2404
             $op = is_array($range) ? 'between' : '>=';
2405 2405
         }
2406 2406
 
2407
-        return $this->parseWhereExp($logic, $field, strtolower($op) . ' time', $range, [], true);
2407
+        return $this->parseWhereExp($logic, $field, strtolower($op).' time', $range, [], true);
2408 2408
     }
2409 2409
 
2410 2410
     /**
@@ -2482,7 +2482,7 @@  discard block
 block discarded – undo
2482 2482
         if (is_array($value)) {
2483 2483
             $this->bind = array_merge($this->bind, $value);
2484 2484
         } else {
2485
-            $name = $name ?: 'ThinkBind_' . (count($this->bind) + 1) . '_' . mt_rand() . '_';
2485
+            $name = $name ?: 'ThinkBind_'.(count($this->bind) + 1).'_'.mt_rand().'_';
2486 2486
 
2487 2487
             $this->bind[$name] = [$value, $type];
2488 2488
             return $name;
@@ -2699,10 +2699,10 @@  discard block
 block discarded – undo
2699 2699
                 $count = $this->model->$relation()->getRelationCountQuery($closure, $aggregate, $field, $aggregateField);
2700 2700
 
2701 2701
                 if (empty($aggregateField)) {
2702
-                    $aggregateField = Loader::parseName($relation) . '_' . $aggregate;
2702
+                    $aggregateField = Loader::parseName($relation).'_'.$aggregate;
2703 2703
                 }
2704 2704
 
2705
-                $this->field(['(' . $count . ')' => $aggregateField]);
2705
+                $this->field(['('.$count.')' => $aggregateField]);
2706 2706
             }
2707 2707
         }
2708 2708
 
@@ -3421,10 +3421,10 @@  discard block
 block discarded – undo
3421 3421
     {
3422 3422
         if (!empty($this->model)) {
3423 3423
             $class = get_class($this->model);
3424
-            throw new ModelNotFoundException('model data Not Found:' . $class, $class, $options);
3424
+            throw new ModelNotFoundException('model data Not Found:'.$class, $class, $options);
3425 3425
         }
3426 3426
         $table = is_array($options['table']) ? key($options['table']) : $options['table'];
3427
-        throw new DataNotFoundException('table data not Found:' . $table, $table, $options);
3427
+        throw new DataNotFoundException('table data not Found:'.$table, $table, $options);
3428 3428
     }
3429 3429
 
3430 3430
     /**
@@ -3560,7 +3560,7 @@  discard block
 block discarded – undo
3560 3560
      */
3561 3561
     public function buildSql($sub = true)
3562 3562
     {
3563
-        return $sub ? '( ' . $this->select(false) . ' )' : $this->select(false);
3563
+        return $sub ? '( '.$this->select(false).' )' : $this->select(false);
3564 3564
     }
3565 3565
 
3566 3566
     /**
@@ -3631,7 +3631,7 @@  discard block
 block discarded – undo
3631 3631
         }
3632 3632
 
3633 3633
         if (is_string($pk)) {
3634
-            $key = isset($alias) ? $alias . '.' . $pk : $pk;
3634
+            $key = isset($alias) ? $alias.'.'.$pk : $pk;
3635 3635
             // 根据主键查询
3636 3636
             if (is_array($data)) {
3637 3637
                 $where[$pk] = isset($data[$pk]) ? [$key, '=', $data[$pk]] : [$key, 'in', $data];
@@ -3642,7 +3642,7 @@  discard block
 block discarded – undo
3642 3642
             // 根据复合主键查询
3643 3643
             foreach ($pk as $key) {
3644 3644
                 if (isset($data[$key])) {
3645
-                    $attr        = isset($alias) ? $alias . '.' . $key : $key;
3645
+                    $attr        = isset($alias) ? $alias.'.'.$key : $key;
3646 3646
                     $where[$key] = [$attr, '=', $data[$key]];
3647 3647
                 } else {
3648 3648
                     throw new Exception('miss complex primary data');
@@ -3718,7 +3718,7 @@  discard block
 block discarded – undo
3718 3718
             $page                  = $page > 0 ? $page : 1;
3719 3719
             $listRows              = $listRows > 0 ? $listRows : (is_numeric($options['limit']) ? $options['limit'] : 20);
3720 3720
             $offset                = $listRows * ($page - 1);
3721
-            $options['limit']      = $offset . ',' . $listRows;
3721
+            $options['limit']      = $offset.','.$listRows;
3722 3722
         }
3723 3723
 
3724 3724
         $this->options = $options;
Please login to merge, or discard this patch.
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)) {
@@ -369,12 +369,12 @@  discard block
 block discarded – undo
369 369
 
370 370
             foreach ($pattern as $key => $val) {
371 371
                 if (isset($vars[$key])) {
372
-                    $url = str_replace(['[:' . $key . ']', '<' . $key . '?>', ':' . $key, '<' . $key . '>'], $type ? $vars[$key] : urlencode($vars[$key]), $url);
372
+                    $url = str_replace(['[:'.$key.']', '<'.$key.'?>', ':'.$key, '<'.$key.'>'], $type ? $vars[$key] : urlencode($vars[$key]), $url);
373 373
                     unset($vars[$key]);
374 374
                     $url    = str_replace(['/?', '-?'], ['/', '-'], $url);
375 375
                     $result = [rtrim($url, '?/-'), $domain, $suffix];
376 376
                 } elseif (2 == $val) {
377
-                    $url    = str_replace(['/[:' . $key . ']', '[:' . $key . ']', '<' . $key . '?>'], '', $url);
377
+                    $url    = str_replace(['/[:'.$key.']', '[:'.$key.']', '<'.$key.'?>'], '', $url);
378 378
                     $url    = str_replace(['/?', '-?'], ['/', '-'], $url);
379 379
                     $result = [rtrim($url, '?/-'), $domain, $suffix];
380 380
                 } else {
Please login to merge, or discard this patch.
library/think/cache/driver/File.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
         }
44 44
 
45 45
         if (empty($this->options['path'])) {
46
-            $this->options['path'] = Container::get('app')->getRuntimePath() . 'cache' . DIRECTORY_SEPARATOR;
46
+            $this->options['path'] = Container::get('app')->getRuntimePath().'cache'.DIRECTORY_SEPARATOR;
47 47
         } elseif (substr($this->options['path'], -1) != DIRECTORY_SEPARATOR) {
48 48
             $this->options['path'] .= DIRECTORY_SEPARATOR;
49 49
         }
@@ -82,14 +82,14 @@  discard block
 block discarded – undo
82 82
 
83 83
         if ($this->options['cache_subdir']) {
84 84
             // 使用子目录
85
-            $name = substr($name, 0, 2) . DIRECTORY_SEPARATOR . substr($name, 2);
85
+            $name = substr($name, 0, 2).DIRECTORY_SEPARATOR.substr($name, 2);
86 86
         }
87 87
 
88 88
         if ($this->options['prefix']) {
89
-            $name = $this->options['prefix'] . DIRECTORY_SEPARATOR . $name;
89
+            $name = $this->options['prefix'].DIRECTORY_SEPARATOR.$name;
90 90
         }
91 91
 
92
-        $filename = $this->options['path'] . $name . '.php';
92
+        $filename = $this->options['path'].$name.'.php';
93 93
         $dir      = dirname($filename);
94 94
 
95 95
         if ($auto && !is_dir($dir)) {
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
             $data = gzcompress($data, 3);
185 185
         }
186 186
 
187
-        $data   = "<?php\n//" . sprintf('%012d', $expire) . "\n exit();?>\n" . $data;
187
+        $data   = "<?php\n//".sprintf('%012d', $expire)."\n exit();?>\n".$data;
188 188
         $result = file_put_contents($filename, $data);
189 189
 
190 190
         if ($result) {
@@ -272,13 +272,13 @@  discard block
 block discarded – undo
272 272
 
273 273
         $this->writeTimes++;
274 274
 
275
-        $files = (array) glob($this->options['path'] . ($this->options['prefix'] ? $this->options['prefix'] . DIRECTORY_SEPARATOR : '') . '*');
275
+        $files = (array) glob($this->options['path'].($this->options['prefix'] ? $this->options['prefix'].DIRECTORY_SEPARATOR : '').'*');
276 276
 
277 277
         foreach ($files as $path) {
278 278
             if (is_dir($path)) {
279
-                $matches = glob($path . DIRECTORY_SEPARATOR . '*.php');
279
+                $matches = glob($path.DIRECTORY_SEPARATOR.'*.php');
280 280
                 if (is_array($matches)) {
281
-                    array_map(function ($v) {
281
+                    array_map(function($v) {
282 282
                         $this->unlink($v);
283 283
                     }, $matches);
284 284
                 }
Please login to merge, or discard this patch.
library/think/db/builder/Mysql.php 1 patch
Spacing   +6 added lines, -6 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
     /**
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
             // JSON字段支持
130 130
             list($field, $name) = explode('->', $key, 2);
131 131
 
132
-            return 'json_extract(' . $this->parseKey($query, $field, true) . ', \'$' . (strpos($name, '[') === 0 ? '' : '.') . str_replace('->', '.', $name) . '\')';
132
+            return 'json_extract('.$this->parseKey($query, $field, true).', \'$'.(strpos($name, '[') === 0 ? '' : '.').str_replace('->', '.', $name).'\')';
133 133
         } elseif (strpos($key, '.') && !preg_match('/[,\'\"\(\)`\s]/', $key)) {
134 134
             list($table, $key) = explode('.', $key, 2);
135 135
 
@@ -146,11 +146,11 @@  discard block
 block discarded – undo
146 146
         }
147 147
 
148 148
         if ($strict && !preg_match('/^[\w\.\*]+$/', $key)) {
149
-            throw new Exception('not support data:' . $key);
149
+            throw new Exception('not support data:'.$key);
150 150
         }
151 151
 
152 152
         if ('*' != $key && !preg_match('/[,\'\"\*\(\)`.\s]/', $key)) {
153
-            $key = '`' . $key . '`';
153
+            $key = '`'.$key.'`';
154 154
         }
155 155
 
156 156
         if (isset($table)) {
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
                 $table = str_replace('.', '`.`', $table);
159 159
             }
160 160
 
161
-            $key = '`' . $table . '`.' . $key;
161
+            $key = '`'.$table.'`.'.$key;
162 162
         }
163 163
 
164 164
         return $key;
Please login to merge, or discard this patch.