Completed
Push — 6.0 ( 9f7271...939c37 )
by liu
06:28
created
src/think/db/BaseQuery.php 1 patch
Spacing   +17 added lines, -17 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\db;
14 14
 
@@ -126,15 +126,15 @@  discard block
 block discarded – undo
126 126
             $name = App::parseName(substr($method, 5));
127 127
             array_unshift($args, $name);
128 128
             return call_user_func_array([$this, 'where'], $args);
129
-        } elseif ($this->model && method_exists($this->model, 'scope' . $method)) {
129
+        } elseif ($this->model && method_exists($this->model, 'scope'.$method)) {
130 130
             // 动态调用命名范围
131
-            $method = 'scope' . $method;
131
+            $method = 'scope'.$method;
132 132
             array_unshift($args, $this);
133 133
 
134 134
             call_user_func_array([$this->model, $method], $args);
135 135
             return $this;
136 136
         } else {
137
-            throw new Exception('method not exist:' . static::class . '->' . $method);
137
+            throw new Exception('method not exist:'.static::class.'->'.$method);
138 138
         }
139 139
     }
140 140
 
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 
209 209
         $name = $name ?: $this->name;
210 210
 
211
-        return $this->prefix . App::parseName($name);
211
+        return $this->prefix.App::parseName($name);
212 212
     }
213 213
 
214 214
     /**
@@ -433,10 +433,10 @@  discard block
 block discarded – undo
433 433
         $prefix = $prefix ?: $tableName;
434 434
         foreach ($field as $key => &$val) {
435 435
             if (is_numeric($key) && $alias) {
436
-                $field[$prefix . '.' . $val] = $alias . $val;
436
+                $field[$prefix.'.'.$val] = $alias.$val;
437 437
                 unset($field[$key]);
438 438
             } elseif (is_numeric($key)) {
439
-                $val = $prefix . '.' . $val;
439
+                $val = $prefix.'.'.$val;
440 440
             }
441 441
         }
442 442
 
@@ -490,7 +490,7 @@  discard block
 block discarded – undo
490 490
             // 延迟写入
491 491
             $condition = $this->options['where'] ?? [];
492 492
 
493
-            $guid = md5($this->getTable() . '_' . $field . '_' . serialize($condition));
493
+            $guid = md5($this->getTable().'_'.$field.'_'.serialize($condition));
494 494
             $step = $this->connection->lazyWrite($op, $guid, $step, $lazyTime);
495 495
 
496 496
             if (false === $step) {
@@ -558,7 +558,7 @@  discard block
 block discarded – undo
558 558
      */
559 559
     public function limit(int $offset, int $length = null)
560 560
     {
561
-        $this->options['limit'] = $offset . ($length ? ',' . $length : '');
561
+        $this->options['limit'] = $offset.($length ? ','.$length : '');
562 562
 
563 563
         return $this;
564 564
     }
@@ -691,7 +691,7 @@  discard block
 block discarded – undo
691 691
             $lastId = 'asc' == $sort ? ($result - 1) + ($page - 1) * $listRows : ($result + 1) - ($page - 1) * $listRows;
692 692
         }
693 693
 
694
-        $results = $this->when($lastId, function ($query) use ($key, $sort, $lastId) {
694
+        $results = $this->when($lastId, function($query) use ($key, $sort, $lastId) {
695 695
             $query->where($key, 'asc' == $sort ? '>' : '<', $lastId);
696 696
         })
697 697
             ->limit($listRows)
@@ -728,7 +728,7 @@  discard block
 block discarded – undo
728 728
             $this->order($key, $sort);
729 729
         }
730 730
 
731
-        $result = $this->when($lastId, function ($query) use ($key, $sort, $lastId) {
731
+        $result = $this->when($lastId, function($query) use ($key, $sort, $lastId) {
732 732
             $query->where($key, 'asc' == $sort ? '>' : '<', $lastId);
733 733
         })->limit($limit)->select();
734 734
 
@@ -849,7 +849,7 @@  discard block
 block discarded – undo
849 849
 
850 850
         if (is_string($field)) {
851 851
             if (!empty($this->options['via'])) {
852
-                $field = $this->options['via'] . '.' . $field;
852
+                $field = $this->options['via'].'.'.$field;
853 853
             }
854 854
             if (strpos($field, ',')) {
855 855
                 $field = array_map('trim', explode(',', $field));
@@ -859,9 +859,9 @@  discard block
 block discarded – undo
859 859
         } elseif (!empty($this->options['via'])) {
860 860
             foreach ($field as $key => $val) {
861 861
                 if (is_numeric($key)) {
862
-                    $field[$key] = $this->options['via'] . '.' . $val;
862
+                    $field[$key] = $this->options['via'].'.'.$val;
863 863
                 } else {
864
-                    $field[$this->options['via'] . '.' . $key] = $val;
864
+                    $field[$this->options['via'].'.'.$key] = $val;
865 865
                     unset($field[$key]);
866 866
                 }
867 867
             }
@@ -1535,7 +1535,7 @@  discard block
 block discarded – undo
1535 1535
      */
1536 1536
     public function buildSql(bool $sub = true): string
1537 1537
     {
1538
-        return $sub ? '( ' . $this->fetchSql()->select() . ' )' : $this->fetchSql()->select();
1538
+        return $sub ? '( '.$this->fetchSql()->select().' )' : $this->fetchSql()->select();
1539 1539
     }
1540 1540
 
1541 1541
     /**
@@ -1591,7 +1591,7 @@  discard block
 block discarded – undo
1591 1591
             $page                  = $page > 0 ? $page : 1;
1592 1592
             $listRows              = $listRows ?: (is_numeric($options['limit']) ? $options['limit'] : 20);
1593 1593
             $offset                = $listRows * ($page - 1);
1594
-            $options['limit']      = $offset . ',' . $listRows;
1594
+            $options['limit']      = $offset.','.$listRows;
1595 1595
         }
1596 1596
 
1597 1597
         $this->options = $options;
@@ -1655,7 +1655,7 @@  discard block
 block discarded – undo
1655 1655
                 $alias = $this->options['alias'][$table];
1656 1656
             }
1657 1657
 
1658
-            $key = isset($alias) ? $alias . '.' . $pk : $pk;
1658
+            $key = isset($alias) ? $alias.'.'.$pk : $pk;
1659 1659
             // 根据主键查询
1660 1660
             if (is_array($data)) {
1661 1661
                 $this->where($key, 'in', $data);
Please login to merge, or discard this patch.