@@ -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; |
14 | 14 |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | // +---------------------------------------------------------------------- |
9 | 9 | // | Author: yangweijie <[email protected]> |
10 | 10 | // +---------------------------------------------------------------------- |
11 | -declare (strict_types = 1); |
|
11 | +declare(strict_types=1); |
|
12 | 12 | namespace think\debug; |
13 | 13 | |
14 | 14 | use think\App; |
@@ -52,21 +52,21 @@ discard block |
||
52 | 52 | $mem = number_format((memory_get_usage() - $app->getBeginMem()) / 1024, 2); |
53 | 53 | |
54 | 54 | if ($request->host()) { |
55 | - $uri = $request->protocol() . ' ' . $request->method() . ' : ' . $request->url(true); |
|
55 | + $uri = $request->protocol().' '.$request->method().' : '.$request->url(true); |
|
56 | 56 | } else { |
57 | - $uri = 'cmd:' . implode(' ', $_SERVER['argv']); |
|
57 | + $uri = 'cmd:'.implode(' ', $_SERVER['argv']); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | // 页面Trace信息 |
61 | 61 | $base = [ |
62 | - '请求信息' => date('Y-m-d H:i:s', $request->time()) . ' ' . $uri, |
|
63 | - '运行时间' => number_format((float) $runtime, 6) . 's [ 吞吐率:' . $reqs . 'req/s ] 内存消耗:' . $mem . 'kb 文件加载:' . count(get_included_files()), |
|
64 | - '查询信息' => $app->db->getQueryTimes() . ' queries', |
|
65 | - '缓存信息' => $app->cache->getReadTimes() . ' reads,' . $app->cache->getWriteTimes() . ' writes', |
|
62 | + '请求信息' => date('Y-m-d H:i:s', $request->time()).' '.$uri, |
|
63 | + '运行时间' => number_format((float) $runtime, 6).'s [ 吞吐率:'.$reqs.'req/s ] 内存消耗:'.$mem.'kb 文件加载:'.count(get_included_files()), |
|
64 | + '查询信息' => $app->db->getQueryTimes().' queries', |
|
65 | + '缓存信息' => $app->cache->getReadTimes().' reads,'.$app->cache->getWriteTimes().' writes', |
|
66 | 66 | ]; |
67 | 67 | |
68 | 68 | if ($app->session->getId(false)) { |
69 | - $base['会话信息'] = 'SESSION_ID=' . $app->session->getId(); |
|
69 | + $base['会话信息'] = 'SESSION_ID='.$app->session->getId(); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | $info = $this->getFileInfo(); |
@@ -125,9 +125,9 @@ discard block |
||
125 | 125 | case '调试': |
126 | 126 | $var_type = gettype($m); |
127 | 127 | if (in_array($var_type, ['array', 'string'])) { |
128 | - $line[] = "console.log(" . json_encode($m) . ");"; |
|
128 | + $line[] = "console.log(".json_encode($m).");"; |
|
129 | 129 | } else { |
130 | - $line[] = "console.log(" . json_encode(var_export($m, true)) . ");"; |
|
130 | + $line[] = "console.log(".json_encode(var_export($m, true)).");"; |
|
131 | 131 | } |
132 | 132 | break; |
133 | 133 | case '错误': |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | $line[] = "console.log(\"%c{$msg}\", \"{$style}\");"; |
142 | 142 | break; |
143 | 143 | default: |
144 | - $m = is_string($key) ? $key . ' ' . $m : $key + 1 . ' ' . $m; |
|
144 | + $m = is_string($key) ? $key.' '.$m : $key + 1.' '.$m; |
|
145 | 145 | $msg = json_encode($m); |
146 | 146 | $line[] = "console.log({$msg});"; |
147 | 147 | break; |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | $info = []; |
163 | 163 | |
164 | 164 | foreach ($files as $key => $file) { |
165 | - $info[] = $file . ' ( ' . number_format(filesize($file) / 1024, 2) . ' KB )'; |
|
165 | + $info[] = $file.' ( '.number_format(filesize($file) / 1024, 2).' KB )'; |
|
166 | 166 | } |
167 | 167 | |
168 | 168 | return $info; |
@@ -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 | namespace think\debug; |
13 | 13 | |
14 | 14 | use think\App; |
@@ -57,20 +57,20 @@ discard block |
||
57 | 57 | |
58 | 58 | // 页面Trace信息 |
59 | 59 | if ($request->host()) { |
60 | - $uri = $request->protocol() . ' ' . $request->method() . ' : ' . $request->url(true); |
|
60 | + $uri = $request->protocol().' '.$request->method().' : '.$request->url(true); |
|
61 | 61 | } else { |
62 | - $uri = 'cmd:' . implode(' ', $_SERVER['argv']); |
|
62 | + $uri = 'cmd:'.implode(' ', $_SERVER['argv']); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | $base = [ |
66 | - '请求信息' => date('Y-m-d H:i:s', $request->time()) . ' ' . $uri, |
|
67 | - '运行时间' => number_format((float) $runtime, 6) . 's [ 吞吐率:' . $reqs . 'req/s ] 内存消耗:' . $mem . 'kb 文件加载:' . count(get_included_files()), |
|
68 | - '查询信息' => $app->db->getQueryTimes() . ' queries', |
|
69 | - '缓存信息' => $app->cache->getReadTimes() . ' reads,' . $app->cache->getWriteTimes() . ' writes', |
|
66 | + '请求信息' => date('Y-m-d H:i:s', $request->time()).' '.$uri, |
|
67 | + '运行时间' => number_format((float) $runtime, 6).'s [ 吞吐率:'.$reqs.'req/s ] 内存消耗:'.$mem.'kb 文件加载:'.count(get_included_files()), |
|
68 | + '查询信息' => $app->db->getQueryTimes().' queries', |
|
69 | + '缓存信息' => $app->cache->getReadTimes().' reads,'.$app->cache->getWriteTimes().' writes', |
|
70 | 70 | ]; |
71 | 71 | |
72 | 72 | if ($app->session->getId(false)) { |
73 | - $base['会话信息'] = 'SESSION_ID=' . $app->session->getId(); |
|
73 | + $base['会话信息'] = 'SESSION_ID='.$app->session->getId(); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | $info = $this->getFileInfo(); |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | } |
103 | 103 | // 调用Trace页面模板 |
104 | 104 | ob_start(); |
105 | - include $this->config['file'] ?: __DIR__ . '/../../tpl/page_trace.tpl'; |
|
105 | + include $this->config['file'] ?: __DIR__.'/../../tpl/page_trace.tpl'; |
|
106 | 106 | return ob_get_clean(); |
107 | 107 | } |
108 | 108 | |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | $info = []; |
118 | 118 | |
119 | 119 | foreach ($files as $key => $file) { |
120 | - $info[] = $file . ' ( ' . number_format(filesize($file) / 1024, 2) . ' KB )'; |
|
120 | + $info[] = $file.' ( '.number_format(filesize($file) / 1024, 2).' KB )'; |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | return $info; |
@@ -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\middleware; |
14 | 14 | |
@@ -87,9 +87,9 @@ discard block |
||
87 | 87 | |
88 | 88 | if (isset($key) && 200 == $response->getCode() && $response->isAllowCache()) { |
89 | 89 | $header = $response->getHeader(); |
90 | - $header['Cache-Control'] = 'max-age=' . $expire . ',must-revalidate'; |
|
91 | - $header['Last-Modified'] = gmdate('D, d M Y H:i:s') . ' GMT'; |
|
92 | - $header['Expires'] = gmdate('D, d M Y H:i:s', time() + $expire) . ' GMT'; |
|
90 | + $header['Cache-Control'] = 'max-age='.$expire.',must-revalidate'; |
|
91 | + $header['Last-Modified'] = gmdate('D, d M Y H:i:s').' GMT'; |
|
92 | + $header['Expires'] = gmdate('D, d M Y H:i:s', time() + $expire).' GMT'; |
|
93 | 93 | |
94 | 94 | $this->cache->tag($tag)->set($key, [$response->getContent(), $header], $expire); |
95 | 95 | } |
@@ -138,12 +138,12 @@ discard block |
||
138 | 138 | if (false !== strpos($key, ':')) { |
139 | 139 | $param = $request->param(); |
140 | 140 | foreach ($param as $item => $val) { |
141 | - if (is_string($val) && false !== strpos($key, ':' . $item)) { |
|
142 | - $key = str_replace(':' . $item, $val, $key); |
|
141 | + if (is_string($val) && false !== strpos($key, ':'.$item)) { |
|
142 | + $key = str_replace(':'.$item, $val, $key); |
|
143 | 143 | } |
144 | 144 | } |
145 | 145 | } elseif (strpos($key, ']')) { |
146 | - if ('[' . $request->ext() . ']' == $key) { |
|
146 | + if ('['.$request->ext().']' == $key) { |
|
147 | 147 | // 缓存某个后缀的请求 |
148 | 148 | $key = md5($request->url()); |
149 | 149 | } else { |
@@ -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\middleware; |
14 | 14 |
@@ -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 | |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | |
67 | 67 | protected function getEnv(string $name, $default = null) |
68 | 68 | { |
69 | - $result = getenv('PHP_' . $name); |
|
69 | + $result = getenv('PHP_'.$name); |
|
70 | 70 | |
71 | 71 | if (false === $result) { |
72 | 72 | return $default; |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | foreach ($env as $key => $val) { |
101 | 101 | if (is_array($val)) { |
102 | 102 | foreach ($val as $k => $v) { |
103 | - $this->data[$key . '_' . strtoupper($k)] = $v; |
|
103 | + $this->data[$key.'_'.strtoupper($k)] = $v; |
|
104 | 104 | } |
105 | 105 | } else { |
106 | 106 | $this->data[$key] = $val; |
@@ -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: 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 | |
@@ -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 | } |