@@ -8,7 +8,7 @@ |
||
| 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\contract; |
| 14 | 14 | |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | // +---------------------------------------------------------------------- |
| 9 | 9 | // | Author: yunwuxin <[email protected]> |
| 10 | 10 | // +---------------------------------------------------------------------- |
| 11 | -declare (strict_types = 1); |
|
| 11 | +declare(strict_types=1); |
|
| 12 | 12 | |
| 13 | 13 | namespace think; |
| 14 | 14 | |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | { |
| 44 | 44 | $commands = is_array($commands) ? $commands : func_get_args(); |
| 45 | 45 | |
| 46 | - Console::starting(function (Console $console) use ($commands) { |
|
| 46 | + Console::starting(function(Console $console) use ($commands) { |
|
| 47 | 47 | $console->addCommands($commands); |
| 48 | 48 | }); |
| 49 | 49 | } |
@@ -8,7 +8,7 @@ discard block |
||
| 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; |
| 14 | 14 | |
@@ -384,7 +384,7 @@ discard block |
||
| 384 | 384 | */ |
| 385 | 385 | public function domain(bool $port = false): string |
| 386 | 386 | { |
| 387 | - return $this->scheme() . '://' . $this->host($port); |
|
| 387 | + return $this->scheme().'://'.$this->host($port); |
|
| 388 | 388 | } |
| 389 | 389 | |
| 390 | 390 | /** |
@@ -399,7 +399,7 @@ discard block |
||
| 399 | 399 | if (!$root) { |
| 400 | 400 | $item = explode('.', $this->host()); |
| 401 | 401 | $count = count($item); |
| 402 | - $root = $count > 1 ? $item[$count - 2] . '.' . $item[$count - 1] : $item[0]; |
|
| 402 | + $root = $count > 1 ? $item[$count - 2].'.'.$item[$count - 1] : $item[0]; |
|
| 403 | 403 | } |
| 404 | 404 | |
| 405 | 405 | return $root; |
@@ -487,14 +487,14 @@ discard block |
||
| 487 | 487 | } elseif ($this->server('REQUEST_URI')) { |
| 488 | 488 | $url = $this->server('REQUEST_URI'); |
| 489 | 489 | } elseif ($this->server('ORIG_PATH_INFO')) { |
| 490 | - $url = $this->server('ORIG_PATH_INFO') . (!empty($this->server('QUERY_STRING')) ? '?' . $this->server('QUERY_STRING') : ''); |
|
| 490 | + $url = $this->server('ORIG_PATH_INFO').(!empty($this->server('QUERY_STRING')) ? '?'.$this->server('QUERY_STRING') : ''); |
|
| 491 | 491 | } elseif (isset($_SERVER['argv'][1])) { |
| 492 | 492 | $url = $_SERVER['argv'][1]; |
| 493 | 493 | } else { |
| 494 | 494 | $url = ''; |
| 495 | 495 | } |
| 496 | 496 | |
| 497 | - return $complete ? $this->domain() . $url : $url; |
|
| 497 | + return $complete ? $this->domain().$url : $url; |
|
| 498 | 498 | } |
| 499 | 499 | |
| 500 | 500 | /** |
@@ -522,7 +522,7 @@ discard block |
||
| 522 | 522 | $this->baseUrl = strpos($str, '?') ? strstr($str, '?', true) : $str; |
| 523 | 523 | } |
| 524 | 524 | |
| 525 | - return $complete ? $this->domain() . $this->baseUrl : $this->baseUrl; |
|
| 525 | + return $complete ? $this->domain().$this->baseUrl : $this->baseUrl; |
|
| 526 | 526 | } |
| 527 | 527 | |
| 528 | 528 | /** |
@@ -543,8 +543,8 @@ discard block |
||
| 543 | 543 | $url = $this->server('PHP_SELF'); |
| 544 | 544 | } elseif (basename($this->server('ORIG_SCRIPT_NAME')) === $script_name) { |
| 545 | 545 | $url = $this->server('ORIG_SCRIPT_NAME'); |
| 546 | - } elseif (($pos = strpos($this->server('PHP_SELF'), '/' . $script_name)) !== false) { |
|
| 547 | - $url = substr($this->server('SCRIPT_NAME'), 0, $pos) . '/' . $script_name; |
|
| 546 | + } elseif (($pos = strpos($this->server('PHP_SELF'), '/'.$script_name)) !== false) { |
|
| 547 | + $url = substr($this->server('SCRIPT_NAME'), 0, $pos).'/'.$script_name; |
|
| 548 | 548 | } elseif ($this->server('DOCUMENT_ROOT') && strpos($this->server('SCRIPT_FILENAME'), $this->server('DOCUMENT_ROOT')) === 0) { |
| 549 | 549 | $url = str_replace('\\', '/', str_replace($this->server('DOCUMENT_ROOT'), '', $this->server('SCRIPT_FILENAME'))); |
| 550 | 550 | } |
@@ -552,7 +552,7 @@ discard block |
||
| 552 | 552 | $this->baseFile = $url; |
| 553 | 553 | } |
| 554 | 554 | |
| 555 | - return $complete ? $this->domain() . $this->baseFile : $this->baseFile; |
|
| 555 | + return $complete ? $this->domain().$this->baseFile : $this->baseFile; |
|
| 556 | 556 | } |
| 557 | 557 | |
| 558 | 558 | /** |
@@ -583,7 +583,7 @@ discard block |
||
| 583 | 583 | $this->root = rtrim($file, '/'); |
| 584 | 584 | } |
| 585 | 585 | |
| 586 | - return $complete ? $this->domain() . $this->root : $this->root; |
|
| 586 | + return $complete ? $this->domain().$this->root : $this->root; |
|
| 587 | 587 | } |
| 588 | 588 | |
| 589 | 589 | /** |
@@ -597,7 +597,7 @@ discard block |
||
| 597 | 597 | $root = strpos($base, '.') ? ltrim(dirname($base), DIRECTORY_SEPARATOR) : $base; |
| 598 | 598 | |
| 599 | 599 | if ('' != $root) { |
| 600 | - $root = '/' . ltrim($root, '/'); |
|
| 600 | + $root = '/'.ltrim($root, '/'); |
|
| 601 | 601 | } |
| 602 | 602 | |
| 603 | 603 | return $root; |
@@ -1334,7 +1334,7 @@ discard block |
||
| 1334 | 1334 | if (is_scalar($data)) { |
| 1335 | 1335 | $data = (string) $data; |
| 1336 | 1336 | } else { |
| 1337 | - throw new \InvalidArgumentException('variable type error:' . gettype($data)); |
|
| 1337 | + throw new \InvalidArgumentException('variable type error:'.gettype($data)); |
|
| 1338 | 1338 | } |
| 1339 | 1339 | break; |
| 1340 | 1340 | } |
@@ -8,7 +8,7 @@ discard block |
||
| 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; |
| 14 | 14 | |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | if (is_string($msg) && !empty($context)) { |
| 126 | 126 | $replace = []; |
| 127 | 127 | foreach ($context as $key => $val) { |
| 128 | - $replace['{' . $key . '}'] = $val; |
|
| 128 | + $replace['{'.$key.'}'] = $val; |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | $msg = strtr($msg, $replace); |
@@ -8,7 +8,7 @@ discard block |
||
| 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; |
| 14 | 14 | |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | */ |
| 102 | 102 | public static function create($data = '', string $type = '', int $code = 200): Response |
| 103 | 103 | { |
| 104 | - $class = false !== strpos($type, '\\') ? $type : '\\think\\response\\' . ucfirst(strtolower($type)); |
|
| 104 | + $class = false !== strpos($type, '\\') ? $type : '\\think\\response\\'.ucfirst(strtolower($type)); |
|
| 105 | 105 | |
| 106 | 106 | if (class_exists($class)) { |
| 107 | 107 | return Container::getInstance()->invokeClass($class, [$data, $code]); |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | http_response_code($this->code); |
| 151 | 151 | // 发送头部信息 |
| 152 | 152 | foreach ($this->header as $name => $val) { |
| 153 | - header($name . (!is_null($val) ? ':' . $val : '')); |
|
| 153 | + header($name.(!is_null($val) ? ':'.$val : '')); |
|
| 154 | 154 | } |
| 155 | 155 | } |
| 156 | 156 | |
@@ -343,7 +343,7 @@ discard block |
||
| 343 | 343 | */ |
| 344 | 344 | public function contentType(string $contentType, string $charset = 'utf-8') |
| 345 | 345 | { |
| 346 | - $this->header['Content-Type'] = $contentType . '; charset=' . $charset; |
|
| 346 | + $this->header['Content-Type'] = $contentType.'; charset='.$charset; |
|
| 347 | 347 | |
| 348 | 348 | return $this; |
| 349 | 349 | } |
@@ -8,7 +8,7 @@ discard block |
||
| 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; |
| 14 | 14 | |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | return $this->make($abstract); |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | - throw new ClassNotFoundException('class not exists: ' . $abstract, $abstract); |
|
| 144 | + throw new ClassNotFoundException('class not exists: '.$abstract, $abstract); |
|
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | /** |
@@ -299,7 +299,7 @@ discard block |
||
| 299 | 299 | |
| 300 | 300 | return call_user_func_array($function, $args); |
| 301 | 301 | } catch (ReflectionException $e) { |
| 302 | - throw new Exception('function not exists: ' . $function . '()'); |
|
| 302 | + throw new Exception('function not exists: '.$function.'()'); |
|
| 303 | 303 | } |
| 304 | 304 | } |
| 305 | 305 | |
@@ -327,12 +327,12 @@ discard block |
||
| 327 | 327 | } catch (ReflectionException $e) { |
| 328 | 328 | if (is_array($method)) { |
| 329 | 329 | $class = is_object($method[0]) ? get_class($method[0]) : $method[0]; |
| 330 | - $callback = $class . '::' . $method[1]; |
|
| 330 | + $callback = $class.'::'.$method[1]; |
|
| 331 | 331 | } else { |
| 332 | 332 | $callback = $method; |
| 333 | 333 | } |
| 334 | 334 | |
| 335 | - throw new Exception('method not exists: ' . $callback . '()'); |
|
| 335 | + throw new Exception('method not exists: '.$callback.'()'); |
|
| 336 | 336 | } |
| 337 | 337 | } |
| 338 | 338 | |
@@ -394,7 +394,7 @@ discard block |
||
| 394 | 394 | |
| 395 | 395 | return $reflect->newInstanceArgs($args); |
| 396 | 396 | } catch (ReflectionException $e) { |
| 397 | - throw new ClassNotFoundException('class not exists: ' . $class, $class); |
|
| 397 | + throw new ClassNotFoundException('class not exists: '.$class, $class); |
|
| 398 | 398 | } |
| 399 | 399 | } |
| 400 | 400 | |
@@ -433,7 +433,7 @@ discard block |
||
| 433 | 433 | } elseif ($param->isDefaultValueAvailable()) { |
| 434 | 434 | $args[] = $param->getDefaultValue(); |
| 435 | 435 | } else { |
| 436 | - throw new InvalidArgumentException('method param miss:' . $name); |
|
| 436 | + throw new InvalidArgumentException('method param miss:'.$name); |
|
| 437 | 437 | } |
| 438 | 438 | } |
| 439 | 439 | |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | // +---------------------------------------------------------------------- |
| 9 | 9 | // | Author: zhangyajun <[email protected]> |
| 10 | 10 | // +---------------------------------------------------------------------- |
| 11 | -declare (strict_types = 1); |
|
| 11 | +declare(strict_types=1); |
|
| 12 | 12 | |
| 13 | 13 | namespace think\model; |
| 14 | 14 | |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | */ |
| 45 | 45 | public function delete(): bool |
| 46 | 46 | { |
| 47 | - $this->each(function (Model $model) { |
|
| 47 | + $this->each(function(Model $model) { |
|
| 48 | 48 | $model->delete(); |
| 49 | 49 | }); |
| 50 | 50 | |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | */ |
| 61 | 61 | public function update(array $data, array $allowField = []): bool |
| 62 | 62 | { |
| 63 | - $this->each(function (Model $model) use ($data, $allowField) { |
|
| 63 | + $this->each(function(Model $model) use ($data, $allowField) { |
|
| 64 | 64 | if (!empty($allowField)) { |
| 65 | 65 | $model->allowField($allowField); |
| 66 | 66 | } |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | */ |
| 80 | 80 | public function hidden(array $hidden) |
| 81 | 81 | { |
| 82 | - $this->each(function (Model $model) use ($hidden) { |
|
| 82 | + $this->each(function(Model $model) use ($hidden) { |
|
| 83 | 83 | $model->hidden($hidden); |
| 84 | 84 | }); |
| 85 | 85 | |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | */ |
| 95 | 95 | public function visible(array $visible) |
| 96 | 96 | { |
| 97 | - $this->each(function (Model $model) use ($visible) { |
|
| 97 | + $this->each(function(Model $model) use ($visible) { |
|
| 98 | 98 | $model->visible($visible); |
| 99 | 99 | }); |
| 100 | 100 | |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | */ |
| 110 | 110 | public function append(array $append) |
| 111 | 111 | { |
| 112 | - $this->each(function (Model $model) use ($append) { |
|
| 112 | + $this->each(function(Model $model) use ($append) { |
|
| 113 | 113 | $model->append($append); |
| 114 | 114 | }); |
| 115 | 115 | |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | */ |
| 125 | 125 | public function setParent(Model $parent) |
| 126 | 126 | { |
| 127 | - $this->each(function (Model $model) use ($parent) { |
|
| 127 | + $this->each(function(Model $model) use ($parent) { |
|
| 128 | 128 | $model->setParent($parent); |
| 129 | 129 | }); |
| 130 | 130 | |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | */ |
| 141 | 141 | public function withAttr($name, $callback = null) |
| 142 | 142 | { |
| 143 | - $this->each(function (Model $model) use ($name, $callback) { |
|
| 143 | + $this->each(function(Model $model) use ($name, $callback) { |
|
| 144 | 144 | $model->withAttribute($name, $callback); |
| 145 | 145 | }); |
| 146 | 146 | |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | */ |
| 158 | 158 | public function bindAttr(string $relation, array $attrs = []) |
| 159 | 159 | { |
| 160 | - $this->each(function (Model $model) use ($relation, $attrs) { |
|
| 160 | + $this->each(function(Model $model) use ($relation, $attrs) { |
|
| 161 | 161 | $model->bindAttr($relation, $attrs); |
| 162 | 162 | }); |
| 163 | 163 | |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | // +---------------------------------------------------------------------- |
| 9 | 9 | // | Author: liu21st <[email protected]> |
| 10 | 10 | // +---------------------------------------------------------------------- |
| 11 | -declare (strict_types = 1); |
|
| 11 | +declare(strict_types=1); |
|
| 12 | 12 | |
| 13 | 13 | namespace think\model\concern; |
| 14 | 14 | |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | $query->where($data); |
| 156 | 156 | $data = null; |
| 157 | 157 | } elseif ($data instanceof \Closure) { |
| 158 | - call_user_func_array($data, [ & $query]); |
|
| 158 | + call_user_func_array($data, [& $query]); |
|
| 159 | 159 | $data = null; |
| 160 | 160 | } elseif (is_null($data)) { |
| 161 | 161 | return false; |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | } |
| 218 | 218 | |
| 219 | 219 | if (false === strpos($field, '.')) { |
| 220 | - $field = '__TABLE__.' . $field; |
|
| 220 | + $field = '__TABLE__.'.$field; |
|
| 221 | 221 | } |
| 222 | 222 | |
| 223 | 223 | if (!$read && strpos($field, '.')) { |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | // +---------------------------------------------------------------------- |
| 9 | 9 | // | Author: liu21st <[email protected]> |
| 10 | 10 | // +---------------------------------------------------------------------- |
| 11 | -declare (strict_types = 1); |
|
| 11 | +declare(strict_types=1); |
|
| 12 | 12 | |
| 13 | 13 | namespace think\model\concern; |
| 14 | 14 | |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | return true; |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - $call = 'on' . App::parseName($event, 1); |
|
| 55 | + $call = 'on'.App::parseName($event, 1); |
|
| 56 | 56 | |
| 57 | 57 | try { |
| 58 | 58 | if (method_exists(static::class, $call)) { |