@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | } elseif (array_key_exists($name, $this->relation)) { |
272 | 272 | return $this->relation[$name]; |
273 | 273 | } |
274 | - throw new InvalidArgumentException('property not exists:' . static::class . '->' . $name); |
|
274 | + throw new InvalidArgumentException('property not exists:'.static::class.'->'.$name); |
|
275 | 275 | } |
276 | 276 | |
277 | 277 | /** |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | if ($this->force) { |
285 | 285 | $data = $this->data; |
286 | 286 | } else { |
287 | - $data = array_udiff_assoc($this->data, $this->origin, function ($a, $b) { |
|
287 | + $data = array_udiff_assoc($this->data, $this->origin, function($a, $b) { |
|
288 | 288 | if ((empty($a) || empty($b)) && $a !== $b) { |
289 | 289 | return 1; |
290 | 290 | } |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | $value = $this->autoWriteTimestamp($name); |
325 | 325 | } else { |
326 | 326 | // 检测修改器 |
327 | - $method = 'set' . Loader::parseName($name, 1) . 'Attr'; |
|
327 | + $method = 'set'.Loader::parseName($name, 1).'Attr'; |
|
328 | 328 | |
329 | 329 | if (method_exists($this, $method)) { |
330 | 330 | $origin = $this->data; |
@@ -481,7 +481,7 @@ discard block |
||
481 | 481 | |
482 | 482 | // 检测属性获取器 |
483 | 483 | $fieldName = Loader::parseName($name); |
484 | - $method = 'get' . Loader::parseName($name, 1) . 'Attr'; |
|
484 | + $method = 'get'.Loader::parseName($name, 1).'Attr'; |
|
485 | 485 | |
486 | 486 | if (isset($this->withAttr[$fieldName])) { |
487 | 487 | if ($notFound && $relation = $this->isRelationAttr($name)) { |
@@ -540,7 +540,7 @@ discard block |
||
540 | 540 | $key = is_numeric($key) ? $attr : $key; |
541 | 541 | |
542 | 542 | if (isset($item[$key])) { |
543 | - throw new Exception('bind attr has exists:' . $key); |
|
543 | + throw new Exception('bind attr has exists:'.$key); |
|
544 | 544 | } else { |
545 | 545 | $item[$key] = $value ? $value->getAttr($attr) : null; |
546 | 546 | } |
@@ -556,7 +556,7 @@ discard block |
||
556 | 556 | } |
557 | 557 | } |
558 | 558 | |
559 | - throw new InvalidArgumentException('property not exists:' . static::class . '->' . $name); |
|
559 | + throw new InvalidArgumentException('property not exists:'.static::class.'->'.$name); |
|
560 | 560 | } |
561 | 561 | |
562 | 562 | /** |
@@ -85,7 +85,7 @@ |
||
85 | 85 | foreach ($append as $key => $attr) { |
86 | 86 | $key = is_numeric($key) ? $attr : $key; |
87 | 87 | if (isset($this->data[$key])) { |
88 | - throw new Exception('bind attr has exists:' . $key); |
|
88 | + throw new Exception('bind attr has exists:'.$key); |
|
89 | 89 | } else { |
90 | 90 | $this->data[$key] = $model->$attr; |
91 | 91 | } |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | public function setRelation($name, $value, $data = []) |
105 | 105 | { |
106 | 106 | // 检测修改器 |
107 | - $method = 'set' . Loader::parseName($name, 1) . 'Attr'; |
|
107 | + $method = 'set'.Loader::parseName($name, 1).'Attr'; |
|
108 | 108 | |
109 | 109 | if (method_exists($this, $method)) { |
110 | 110 | $value = $this->$method($value, array_merge($this->data, $data)); |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | $count = $this->$relation()->relationCount($result, $closure, $aggregate, $field, $name); |
325 | 325 | |
326 | 326 | if (empty($name)) { |
327 | - $name = Loader::parseName($relation) . '_' . $aggregate; |
|
327 | + $name = Loader::parseName($relation).'_'.$aggregate; |
|
328 | 328 | } |
329 | 329 | |
330 | 330 | $result->setAttr($name, $count); |
@@ -423,8 +423,8 @@ discard block |
||
423 | 423 | // 记录当前关联信息 |
424 | 424 | $model = $this->parseModel($model); |
425 | 425 | $name = Loader::parseName(basename(str_replace('\\', '/', $model))); |
426 | - $table = $table ?: Loader::parseName($this->name) . '_' . $name; |
|
427 | - $foreignKey = $foreignKey ?: $name . '_id'; |
|
426 | + $table = $table ?: Loader::parseName($this->name).'_'.$name; |
|
427 | + $foreignKey = $foreignKey ?: $name.'_id'; |
|
428 | 428 | $localKey = $localKey ?: $this->getForeignKey($this->name); |
429 | 429 | |
430 | 430 | return new BelongsToMany($this, $model, $table, $foreignKey, $localKey); |
@@ -451,8 +451,8 @@ discard block |
||
451 | 451 | if (is_array($morph)) { |
452 | 452 | list($morphType, $foreignKey) = $morph; |
453 | 453 | } else { |
454 | - $morphType = $morph . '_type'; |
|
455 | - $foreignKey = $morph . '_id'; |
|
454 | + $morphType = $morph.'_type'; |
|
455 | + $foreignKey = $morph.'_id'; |
|
456 | 456 | } |
457 | 457 | |
458 | 458 | $type = $type ?: get_class($this); |
@@ -483,8 +483,8 @@ discard block |
||
483 | 483 | if (is_array($morph)) { |
484 | 484 | list($morphType, $foreignKey) = $morph; |
485 | 485 | } else { |
486 | - $morphType = $morph . '_type'; |
|
487 | - $foreignKey = $morph . '_id'; |
|
486 | + $morphType = $morph.'_type'; |
|
487 | + $foreignKey = $morph.'_id'; |
|
488 | 488 | } |
489 | 489 | |
490 | 490 | return new MorphMany($this, $model, $foreignKey, $morphType, $type); |
@@ -510,8 +510,8 @@ discard block |
||
510 | 510 | if (is_array($morph)) { |
511 | 511 | list($morphType, $foreignKey) = $morph; |
512 | 512 | } else { |
513 | - $morphType = $morph . '_type'; |
|
514 | - $foreignKey = $morph . '_id'; |
|
513 | + $morphType = $morph.'_type'; |
|
514 | + $foreignKey = $morph.'_id'; |
|
515 | 515 | } |
516 | 516 | |
517 | 517 | return new MorphTo($this, $morphType, $foreignKey, $alias, $relation); |
@@ -547,7 +547,7 @@ discard block |
||
547 | 547 | $name = basename(str_replace('\\', '/', $name)); |
548 | 548 | } |
549 | 549 | |
550 | - return Loader::parseName($name) . '_id'; |
|
550 | + return Loader::parseName($name).'_id'; |
|
551 | 551 | } |
552 | 552 | |
553 | 553 | /** |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | $query->where($data); |
147 | 147 | $data = null; |
148 | 148 | } elseif ($data instanceof \Closure) { |
149 | - call_user_func_array($data, [ & $query]); |
|
149 | + call_user_func_array($data, [& $query]); |
|
150 | 150 | $data = null; |
151 | 151 | } elseif (is_null($data)) { |
152 | 152 | return false; |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | } |
214 | 214 | |
215 | 215 | if (false === strpos($field, '.')) { |
216 | - $field = '__TABLE__.' . $field; |
|
216 | + $field = '__TABLE__.'.$field; |
|
217 | 217 | } |
218 | 218 | |
219 | 219 | if (!$read && strpos($field, '.')) { |
@@ -231,7 +231,7 @@ |
||
231 | 231 | } |
232 | 232 | |
233 | 233 | return $this->query |
234 | - ->whereExp($this->morphKey, '=' . $this->parent->getTable() . '.' . $this->parent->getPk()) |
|
234 | + ->whereExp($this->morphKey, '='.$this->parent->getTable().'.'.$this->parent->getPk()) |
|
235 | 235 | ->where($this->morphType, '=', $this->type) |
236 | 236 | ->fetchSql() |
237 | 237 | ->$aggregate($field); |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | // 关联查询 |
153 | 153 | $pk = $this->parent->getPk(); |
154 | 154 | |
155 | - $condition[] = ['pivot.' . $localKey, '=', $this->parent->$pk]; |
|
155 | + $condition[] = ['pivot.'.$localKey, '=', $this->parent->$pk]; |
|
156 | 156 | |
157 | 157 | return $this->belongsToManyQuery($foreignKey, $localKey, $condition); |
158 | 158 | } |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | */ |
282 | 282 | public function wherePivot($field, $op = null, $condition = null) |
283 | 283 | { |
284 | - $this->query->where('pivot.' . $field, $op, $condition); |
|
284 | + $this->query->where('pivot.'.$field, $op, $condition); |
|
285 | 285 | return $this; |
286 | 286 | } |
287 | 287 | |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | if (!empty($range)) { |
312 | 312 | // 查询关联数据 |
313 | 313 | $data = $this->eagerlyManyToMany([ |
314 | - ['pivot.' . $localKey, 'in', $range], |
|
314 | + ['pivot.'.$localKey, 'in', $range], |
|
315 | 315 | ], $relation, $subRelation, $closure); |
316 | 316 | |
317 | 317 | // 关联属性名 |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | $pk = $result->$pk; |
346 | 346 | // 查询管理数据 |
347 | 347 | $data = $this->eagerlyManyToMany([ |
348 | - ['pivot.' . $this->localKey, '=', $pk], |
|
348 | + ['pivot.'.$this->localKey, '=', $pk], |
|
349 | 349 | ], $relation, $subRelation, $closure); |
350 | 350 | |
351 | 351 | // 关联数据封装 |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | } |
387 | 387 | |
388 | 388 | return $this->belongsToManyQuery($this->foreignKey, $this->localKey, [ |
389 | - ['pivot.' . $this->localKey, '=', $pk], |
|
389 | + ['pivot.'.$this->localKey, '=', $pk], |
|
390 | 390 | ])->$aggregate($field); |
391 | 391 | } |
392 | 392 | |
@@ -411,7 +411,7 @@ discard block |
||
411 | 411 | |
412 | 412 | return $this->belongsToManyQuery($this->foreignKey, $this->localKey, [ |
413 | 413 | [ |
414 | - 'pivot.' . $this->localKey, 'exp', $this->query->raw('=' . $this->parent->getTable() . '.' . $this->parent->getPk()), |
|
414 | + 'pivot.'.$this->localKey, 'exp', $this->query->raw('='.$this->parent->getTable().'.'.$this->parent->getPk()), |
|
415 | 415 | ], |
416 | 416 | ])->fetchSql()->$aggregate($field); |
417 | 417 | } |
@@ -479,7 +479,7 @@ discard block |
||
479 | 479 | |
480 | 480 | if (empty($this->baseQuery)) { |
481 | 481 | $relationFk = $this->query->getPk(); |
482 | - $query->join([$table => 'pivot'], 'pivot.' . $foreignKey . '=' . $tableName . '.' . $relationFk) |
|
482 | + $query->join([$table => 'pivot'], 'pivot.'.$foreignKey.'='.$tableName.'.'.$relationFk) |
|
483 | 483 | ->where($condition); |
484 | 484 | } |
485 | 485 | |
@@ -701,8 +701,8 @@ discard block |
||
701 | 701 | $table = $this->pivot->getTable(); |
702 | 702 | |
703 | 703 | $this->query |
704 | - ->join([$table => 'pivot'], 'pivot.' . $this->foreignKey . '=' . $this->query->getTable() . '.' . $this->query->getPk()) |
|
705 | - ->where('pivot.' . $this->localKey, $this->parent->$pk); |
|
704 | + ->join([$table => 'pivot'], 'pivot.'.$this->foreignKey.'='.$this->query->getTable().'.'.$this->query->getPk()) |
|
705 | + ->where('pivot.'.$this->localKey, $this->parent->$pk); |
|
706 | 706 | $this->baseQuery = true; |
707 | 707 | } |
708 | 708 | } |
@@ -82,9 +82,9 @@ discard block |
||
82 | 82 | $query->via($joinAlias); |
83 | 83 | |
84 | 84 | if ($this instanceof BelongsTo) { |
85 | - $joinOn = $name . '.' . $this->foreignKey . '=' . $joinAlias . '.' . $this->localKey; |
|
85 | + $joinOn = $name.'.'.$this->foreignKey.'='.$joinAlias.'.'.$this->localKey; |
|
86 | 86 | } else { |
87 | - $joinOn = $name . '.' . $this->localKey . '=' . $joinAlias . '.' . $this->foreignKey; |
|
87 | + $joinOn = $name.'.'.$this->localKey.'='.$joinAlias.'.'.$this->foreignKey; |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | if ($closure) { |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | } |
100 | 100 | |
101 | 101 | $query->join([$joinTable => $joinAlias], $joinOn, $joinType) |
102 | - ->field($field, false, $joinTable, $joinAlias, $relation . '__'); |
|
102 | + ->field($field, false, $joinTable, $joinAlias, $relation.'__'); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | /** |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | foreach ($this->bindAttr as $key => $attr) { |
292 | 292 | $key = is_numeric($key) ? $attr : $key; |
293 | 293 | if (isset($result->$key)) { |
294 | - throw new Exception('bind attr has exists:' . $key); |
|
294 | + throw new Exception('bind attr has exists:'.$key); |
|
295 | 295 | } else { |
296 | 296 | $result->setAttr($key, $model ? $model->$attr : null); |
297 | 297 | } |
@@ -17,13 +17,13 @@ |
||
17 | 17 | { |
18 | 18 | |
19 | 19 | if ($e instanceof \ParseError) { |
20 | - $message = 'Parse error: ' . $e->getMessage(); |
|
20 | + $message = 'Parse error: '.$e->getMessage(); |
|
21 | 21 | $severity = E_PARSE; |
22 | 22 | } elseif ($e instanceof \TypeError) { |
23 | - $message = 'Type error: ' . $e->getMessage(); |
|
23 | + $message = 'Type error: '.$e->getMessage(); |
|
24 | 24 | $severity = E_RECOVERABLE_ERROR; |
25 | 25 | } else { |
26 | - $message = 'Fatal error: ' . $e->getMessage(); |
|
26 | + $message = 'Fatal error: '.$e->getMessage(); |
|
27 | 27 | $severity = E_ERROR; |
28 | 28 | } |
29 | 29 |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | } |
57 | 57 | |
58 | 58 | if (Container::get('app')->config('log.record_trace')) { |
59 | - $log .= "\r\n" . $exception->getTraceAsString(); |
|
59 | + $log .= "\r\n".$exception->getTraceAsString(); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | Container::get('log')->record($log, 'error'); |
@@ -237,10 +237,10 @@ discard block |
||
237 | 237 | |
238 | 238 | if (strpos($message, ':')) { |
239 | 239 | $name = strstr($message, ':', true); |
240 | - $message = $lang->has($name) ? $lang->get($name) . strstr($message, ':') : $message; |
|
240 | + $message = $lang->has($name) ? $lang->get($name).strstr($message, ':') : $message; |
|
241 | 241 | } elseif (strpos($message, ',')) { |
242 | 242 | $name = strstr($message, ',', true); |
243 | - $message = $lang->has($name) ? $lang->get($name) . ':' . substr(strstr($message, ','), 1) : $message; |
|
243 | + $message = $lang->has($name) ? $lang->get($name).':'.substr(strstr($message, ','), 1) : $message; |
|
244 | 244 | } elseif ($lang->has($message)) { |
245 | 245 | $message = $lang->get($message); |
246 | 246 | } |