@@ -31,7 +31,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -194,8 +194,8 @@ discard block |
||
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 |
||
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 |
||
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 | } |
@@ -88,7 +88,7 @@ discard block |
||
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 |
||
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 |
||
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 | } |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | } |
41 | 41 | |
42 | 42 | if (empty($this->config['path'])) { |
43 | - $this->config['path'] = $this->app->getRuntimePath() . 'log' . DIRECTORY_SEPARATOR; |
|
43 | + $this->config['path'] = $this->app->getRuntimePath().'log'.DIRECTORY_SEPARATOR; |
|
44 | 44 | } elseif (substr($this->config['path'], -1) != DIRECTORY_SEPARATOR) { |
45 | 45 | $this->config['path'] .= DIRECTORY_SEPARATOR; |
46 | 46 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | $msg = var_export($msg, true); |
70 | 70 | } |
71 | 71 | |
72 | - $info[$type][] = $this->config['json'] ? $msg : '[ ' . $type . ' ] ' . $msg; |
|
72 | + $info[$type][] = $this->config['json'] ? $msg : '[ '.$type.' ] '.$msg; |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | if (!$this->config['json'] && (true === $this->config['apart_level'] || in_array($type, $this->config['apart_level']))) { |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | protected function getMasterLogFile() |
137 | 137 | { |
138 | 138 | if ($this->config['max_files']) { |
139 | - $files = glob($this->config['path'] . '*.log'); |
|
139 | + $files = glob($this->config['path'].'*.log'); |
|
140 | 140 | |
141 | 141 | try { |
142 | 142 | if (count($files) > $this->config['max_files']) { |
@@ -151,15 +151,15 @@ discard block |
||
151 | 151 | if ($this->config['single']) { |
152 | 152 | $name = is_string($this->config['single']) ? $this->config['single'] : 'single'; |
153 | 153 | |
154 | - $destination = $this->config['path'] . $name . $cli . '.log'; |
|
154 | + $destination = $this->config['path'].$name.$cli.'.log'; |
|
155 | 155 | } else { |
156 | 156 | if ($this->config['max_files']) { |
157 | - $filename = date('Ymd') . $cli . '.log'; |
|
157 | + $filename = date('Ymd').$cli.'.log'; |
|
158 | 158 | } else { |
159 | - $filename = date('Ym') . DIRECTORY_SEPARATOR . date('d') . $cli . '.log'; |
|
159 | + $filename = date('Ym').DIRECTORY_SEPARATOR.date('d').$cli.'.log'; |
|
160 | 160 | } |
161 | 161 | |
162 | - $destination = $this->config['path'] . $filename; |
|
162 | + $destination = $this->config['path'].$filename; |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | return $destination; |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | $name = date('d'); |
185 | 185 | } |
186 | 186 | |
187 | - return $path . DIRECTORY_SEPARATOR . $name . '_' . $type . $cli . '.log'; |
|
187 | + return $path.DIRECTORY_SEPARATOR.$name.'_'.$type.$cli.'.log'; |
|
188 | 188 | } |
189 | 189 | |
190 | 190 | /** |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | { |
198 | 198 | if (is_file($destination) && floor($this->config['file_size']) <= filesize($destination)) { |
199 | 199 | try { |
200 | - rename($destination, dirname($destination) . DIRECTORY_SEPARATOR . time() . '-' . basename($destination)); |
|
200 | + rename($destination, dirname($destination).DIRECTORY_SEPARATOR.time().'-'.basename($destination)); |
|
201 | 201 | } catch (\Exception $e) { |
202 | 202 | } |
203 | 203 | } |
@@ -212,14 +212,14 @@ discard block |
||
212 | 212 | protected function parseCliLog($info) |
213 | 213 | { |
214 | 214 | if ($this->config['json']) { |
215 | - $message = json_encode($info, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . PHP_EOL; |
|
215 | + $message = json_encode($info, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES).PHP_EOL; |
|
216 | 216 | } else { |
217 | 217 | $now = $info['timestamp']; |
218 | 218 | unset($info['timestamp']); |
219 | 219 | |
220 | 220 | $message = implode(PHP_EOL, $info); |
221 | 221 | |
222 | - $message = "[{$now}]" . $message . PHP_EOL; |
|
222 | + $message = "[{$now}]".$message.PHP_EOL; |
|
223 | 223 | } |
224 | 224 | |
225 | 225 | return $message; |
@@ -242,13 +242,13 @@ discard block |
||
242 | 242 | |
243 | 243 | if ($this->config['json']) { |
244 | 244 | $info = $requestInfo + $info; |
245 | - return json_encode($info, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . PHP_EOL; |
|
245 | + return json_encode($info, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES).PHP_EOL; |
|
246 | 246 | } |
247 | 247 | |
248 | - array_unshift($info, "---------------------------------------------------------------" . PHP_EOL . "\r\n[{$info['timestamp']}] {$requestInfo['ip']} {$requestInfo['method']} {$requestInfo['host']}{$requestInfo['uri']}"); |
|
248 | + array_unshift($info, "---------------------------------------------------------------".PHP_EOL."\r\n[{$info['timestamp']}] {$requestInfo['ip']} {$requestInfo['method']} {$requestInfo['host']}{$requestInfo['uri']}"); |
|
249 | 249 | unset($info['timestamp']); |
250 | 250 | |
251 | - return implode(PHP_EOL, $info) . PHP_EOL; |
|
251 | + return implode(PHP_EOL, $info).PHP_EOL; |
|
252 | 252 | } |
253 | 253 | |
254 | 254 | protected function getDebugLog(&$info, $append, $apart) |
@@ -263,9 +263,9 @@ discard block |
||
263 | 263 | $memory_use = number_format((memory_get_usage() - $this->app->getBeginMem()) / 1024, 2); |
264 | 264 | |
265 | 265 | $info = [ |
266 | - 'runtime' => number_format($runtime, 6) . 's', |
|
267 | - 'reqs' => $reqs . 'req/s', |
|
268 | - 'memory' => $memory_use . 'kb', |
|
266 | + 'runtime' => number_format($runtime, 6).'s', |
|
267 | + 'reqs' => $reqs.'req/s', |
|
268 | + 'memory' => $memory_use.'kb', |
|
269 | 269 | 'file' => count(get_included_files()), |
270 | 270 | ] + $info; |
271 | 271 | |
@@ -276,11 +276,11 @@ discard block |
||
276 | 276 | |
277 | 277 | $memory_use = number_format((memory_get_usage() - $this->app->getBeginMem()) / 1024, 2); |
278 | 278 | |
279 | - $time_str = '[运行时间:' . number_format($runtime, 6) . 's] [吞吐率:' . $reqs . 'req/s]'; |
|
280 | - $memory_str = ' [内存消耗:' . $memory_use . 'kb]'; |
|
281 | - $file_load = ' [文件加载:' . count(get_included_files()) . ']'; |
|
279 | + $time_str = '[运行时间:'.number_format($runtime, 6).'s] [吞吐率:'.$reqs.'req/s]'; |
|
280 | + $memory_str = ' [内存消耗:'.$memory_use.'kb]'; |
|
281 | + $file_load = ' [文件加载:'.count(get_included_files()).']'; |
|
282 | 282 | |
283 | - array_unshift($info, $time_str . $memory_str . $file_load); |
|
283 | + array_unshift($info, $time_str.$memory_str.$file_load); |
|
284 | 284 | } |
285 | 285 | } |
286 | 286 | } |
@@ -89,19 +89,19 @@ discard block |
||
89 | 89 | $softDelete = $this->query->getOptions('soft_delete'); |
90 | 90 | |
91 | 91 | if ('*' != $id) { |
92 | - $id = $relationTable . '.' . $relation->getPk(); |
|
92 | + $id = $relationTable.'.'.$relation->getPk(); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | return $this->parent->db() |
96 | 96 | ->alias($model) |
97 | - ->field($model . '.*') |
|
98 | - ->join($throughTable, $throughTable . '.' . $this->foreignKey . '=' . $model . '.' . $this->localKey) |
|
99 | - ->join($relationTable, $relationTable . '.' . $throughKey . '=' . $throughTable . '.' . $this->throughPk) |
|
100 | - ->when($softDelete, function ($query) use ($softDelete, $relationTable) { |
|
101 | - $query->where($relationTable . strstr($softDelete[0], '.'), '=' == $softDelete[1][0] ? $softDelete[1][1] : null); |
|
97 | + ->field($model.'.*') |
|
98 | + ->join($throughTable, $throughTable.'.'.$this->foreignKey.'='.$model.'.'.$this->localKey) |
|
99 | + ->join($relationTable, $relationTable.'.'.$throughKey.'='.$throughTable.'.'.$this->throughPk) |
|
100 | + ->when($softDelete, function($query) use ($softDelete, $relationTable) { |
|
101 | + $query->where($relationTable.strstr($softDelete[0], '.'), '=' == $softDelete[1][0] ? $softDelete[1][1] : null); |
|
102 | 102 | }) |
103 | - ->group($relationTable . '.' . $this->throughKey) |
|
104 | - ->having('count(' . $id . ')' . $operator . $count); |
|
103 | + ->group($relationTable.'.'.$this->throughKey) |
|
104 | + ->having('count('.$id.')'.$operator.$count); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | /** |
@@ -128,12 +128,12 @@ discard block |
||
128 | 128 | |
129 | 129 | return $this->parent->db() |
130 | 130 | ->alias($model) |
131 | - ->join($throughTable, $throughTable . '.' . $this->foreignKey . '=' . $model . '.' . $this->localKey) |
|
132 | - ->join($modelTable, $modelTable . '.' . $throughKey . '=' . $throughTable . '.' . $this->throughPk) |
|
133 | - ->when($softDelete, function ($query) use ($softDelete, $modelTable) { |
|
134 | - $query->where($modelTable . strstr($softDelete[0], '.'), '=' == $softDelete[1][0] ? $softDelete[1][1] : null); |
|
131 | + ->join($throughTable, $throughTable.'.'.$this->foreignKey.'='.$model.'.'.$this->localKey) |
|
132 | + ->join($modelTable, $modelTable.'.'.$throughKey.'='.$throughTable.'.'.$this->throughPk) |
|
133 | + ->when($softDelete, function($query) use ($softDelete, $modelTable) { |
|
134 | + $query->where($modelTable.strstr($softDelete[0], '.'), '=' == $softDelete[1][0] ? $softDelete[1][1] : null); |
|
135 | 135 | }) |
136 | - ->group($modelTable . '.' . $this->throughKey) |
|
136 | + ->group($modelTable.'.'.$this->throughKey) |
|
137 | 137 | ->where($where) |
138 | 138 | ->field($fields); |
139 | 139 | } |
@@ -285,14 +285,14 @@ discard block |
||
285 | 285 | $modelTable = $this->parent->getTable(); |
286 | 286 | |
287 | 287 | if (false === strpos($field, '.')) { |
288 | - $field = $alias . '.' . $field; |
|
288 | + $field = $alias.'.'.$field; |
|
289 | 289 | } |
290 | 290 | |
291 | 291 | return $this->query |
292 | 292 | ->alias($alias) |
293 | - ->join($throughTable, $throughTable . '.' . $pk . '=' . $alias . '.' . $throughKey) |
|
294 | - ->join($modelTable, $modelTable . '.' . $this->localKey . '=' . $throughTable . '.' . $this->foreignKey) |
|
295 | - ->where($throughTable . '.' . $this->foreignKey, $result->$localKey) |
|
293 | + ->join($throughTable, $throughTable.'.'.$pk.'='.$alias.'.'.$throughKey) |
|
294 | + ->join($modelTable, $modelTable.'.'.$this->localKey.'='.$throughTable.'.'.$this->foreignKey) |
|
295 | + ->where($throughTable.'.'.$this->foreignKey, $result->$localKey) |
|
296 | 296 | ->$aggregate($field); |
297 | 297 | } |
298 | 298 | |
@@ -321,14 +321,14 @@ discard block |
||
321 | 321 | $modelTable = $this->parent->getTable(); |
322 | 322 | |
323 | 323 | if (false === strpos($field, '.')) { |
324 | - $field = $alias . '.' . $field; |
|
324 | + $field = $alias.'.'.$field; |
|
325 | 325 | } |
326 | 326 | |
327 | 327 | return $this->query |
328 | 328 | ->alias($alias) |
329 | - ->join($throughTable, $throughTable . '.' . $pk . '=' . $alias . '.' . $throughKey) |
|
330 | - ->join($modelTable, $modelTable . '.' . $this->localKey . '=' . $throughTable . '.' . $this->foreignKey) |
|
331 | - ->whereExp($throughTable . '.' . $this->foreignKey, '=' . $this->parent->getTable() . '.' . $this->localKey) |
|
329 | + ->join($throughTable, $throughTable.'.'.$pk.'='.$alias.'.'.$throughKey) |
|
330 | + ->join($modelTable, $modelTable.'.'.$this->localKey.'='.$throughTable.'.'.$this->foreignKey) |
|
331 | + ->whereExp($throughTable.'.'.$this->foreignKey, '='.$this->parent->getTable().'.'.$this->localKey) |
|
332 | 332 | ->fetchSql() |
333 | 333 | ->$aggregate($field); |
334 | 334 | } |
@@ -351,9 +351,9 @@ discard block |
||
351 | 351 | $this->query |
352 | 352 | ->field($fields) |
353 | 353 | ->alias($alias) |
354 | - ->join($throughTable, $throughTable . '.' . $pk . '=' . $alias . '.' . $throughKey) |
|
355 | - ->join($modelTable, $modelTable . '.' . $this->localKey . '=' . $throughTable . '.' . $this->foreignKey) |
|
356 | - ->where($throughTable . '.' . $this->foreignKey, $this->parent->{$this->localKey}); |
|
354 | + ->join($throughTable, $throughTable.'.'.$pk.'='.$alias.'.'.$throughKey) |
|
355 | + ->join($modelTable, $modelTable.'.'.$this->localKey.'='.$throughTable.'.'.$this->foreignKey) |
|
356 | + ->where($throughTable.'.'.$this->foreignKey, $this->parent->{$this->localKey}); |
|
357 | 357 | |
358 | 358 | $this->baseQuery = true; |
359 | 359 | } |
@@ -187,8 +187,7 @@ discard block |
||
187 | 187 | $key = $this->getCacheKey($name); |
188 | 188 | |
189 | 189 | return false === $ttl ? |
190 | - $this->handler->delete($key) : |
|
191 | - $this->handler->delete($key, $ttl); |
|
190 | + $this->handler->delete($key) : $this->handler->delete($key, $ttl); |
|
192 | 191 | } |
193 | 192 | |
194 | 193 | /** |
@@ -237,7 +236,7 @@ discard block |
||
237 | 236 | } |
238 | 237 | |
239 | 238 | foreach ($keys as $key) { |
240 | - $this->handler->append($tagName, ',' . $key); |
|
239 | + $this->handler->append($tagName, ','.$key); |
|
241 | 240 | } |
242 | 241 | } |
243 | 242 | |
@@ -256,7 +255,7 @@ discard block |
||
256 | 255 | $tagName = $this->getTagKey($this->tag); |
257 | 256 | |
258 | 257 | if ($this->has($tagName)) { |
259 | - $this->handler->append($tagName, ',' . $name); |
|
258 | + $this->handler->append($tagName, ','.$name); |
|
260 | 259 | } else { |
261 | 260 | $this->handler->set($tagName, $name); |
262 | 261 | } |
@@ -83,9 +83,9 @@ discard block |
||
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 |
||
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 |
||
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 | } |
@@ -95,7 +95,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -132,23 +132,23 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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']), |