@@ -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\route\dispatch; |
14 | 14 |
@@ -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: liu21st <[email protected]> |
10 | 10 | // +---------------------------------------------------------------------- |
11 | -declare (strict_types = 1); |
|
11 | +declare(strict_types=1); |
|
12 | 12 | |
13 | 13 | namespace think; |
14 | 14 | |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | */ |
366 | 366 | public function hasScene(string $name): bool |
367 | 367 | { |
368 | - return isset($this->scene[$name]) || method_exists($this, 'scene' . $name); |
|
368 | + return isset($this->scene[$name]) || method_exists($this, 'scene'.$name); |
|
369 | 369 | } |
370 | 370 | |
371 | 371 | /** |
@@ -717,7 +717,7 @@ discard block |
||
717 | 717 | if (strpos($field, '_confirm')) { |
718 | 718 | $rule = strstr($field, '_confirm', true); |
719 | 719 | } else { |
720 | - $rule = $field . '_confirm'; |
|
720 | + $rule = $field.'_confirm'; |
|
721 | 721 | } |
722 | 722 | } |
723 | 723 | |
@@ -868,9 +868,9 @@ discard block |
||
868 | 868 | if (isset($this->type[$rule])) { |
869 | 869 | // 注册的验证规则 |
870 | 870 | $result = call_user_func_array($this->type[$rule], [$value]); |
871 | - } elseif (function_exists('ctype_' . $rule)) { |
|
871 | + } elseif (function_exists('ctype_'.$rule)) { |
|
872 | 872 | // ctype验证规则 |
873 | - $ctypeFun = 'ctype_' . $rule; |
|
873 | + $ctypeFun = 'ctype_'.$rule; |
|
874 | 874 | $result = $ctypeFun($value); |
875 | 875 | } elseif (isset($this->filter[$rule])) { |
876 | 876 | // Filter_var验证规则 |
@@ -1508,7 +1508,7 @@ discard block |
||
1508 | 1508 | |
1509 | 1509 | if (is_string($rule) && 0 !== strpos($rule, '/') && !preg_match('/\/[imsU]{0,4}$/', $rule)) { |
1510 | 1510 | // 不是正则表达式则两端补上/ |
1511 | - $rule = '/^' . $rule . '$/'; |
|
1511 | + $rule = '/^'.$rule.'$/'; |
|
1512 | 1512 | } |
1513 | 1513 | |
1514 | 1514 | return is_scalar($value) && 1 === preg_match($rule, (string) $value); |
@@ -1558,8 +1558,8 @@ discard block |
||
1558 | 1558 | */ |
1559 | 1559 | protected function getRuleMsg(string $attribute, string $title, string $type, $rule): string |
1560 | 1560 | { |
1561 | - if (isset($this->message[$attribute . '.' . $type])) { |
|
1562 | - $msg = $this->message[$attribute . '.' . $type]; |
|
1561 | + if (isset($this->message[$attribute.'.'.$type])) { |
|
1562 | + $msg = $this->message[$attribute.'.'.$type]; |
|
1563 | 1563 | } elseif (isset($this->message[$attribute][$type])) { |
1564 | 1564 | $msg = $this->message[$attribute][$type]; |
1565 | 1565 | } elseif (isset($this->message[$attribute])) { |
@@ -1569,7 +1569,7 @@ discard block |
||
1569 | 1569 | } elseif (0 === strpos($type, 'require')) { |
1570 | 1570 | $msg = $this->typeMsg['require']; |
1571 | 1571 | } else { |
1572 | - $msg = $title . $this->lang->get('not conform to the rules'); |
|
1572 | + $msg = $title.$this->lang->get('not conform to the rules'); |
|
1573 | 1573 | } |
1574 | 1574 | |
1575 | 1575 | if (!is_string($msg)) { |
@@ -1613,8 +1613,8 @@ discard block |
||
1613 | 1613 | { |
1614 | 1614 | $this->only = $this->append = $this->remove = []; |
1615 | 1615 | |
1616 | - if (method_exists($this, 'scene' . $scene)) { |
|
1617 | - call_user_func([$this, 'scene' . $scene]); |
|
1616 | + if (method_exists($this, 'scene'.$scene)) { |
|
1617 | + call_user_func([$this, 'scene'.$scene]); |
|
1618 | 1618 | } elseif (isset($this->scene[$scene])) { |
1619 | 1619 | // 如果设置了验证适用场景 |
1620 | 1620 | $this->only = $this->scene[$scene]; |
@@ -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\middleware; |
14 | 14 | |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | if ($lang->defaultLangSet() != $langset) { |
41 | 41 | // 加载系统语言包 |
42 | 42 | $lang->load([ |
43 | - $app->getThinkPath() . 'lang' . DIRECTORY_SEPARATOR . $langset . '.php', |
|
43 | + $app->getThinkPath().'lang'.DIRECTORY_SEPARATOR.$langset.'.php', |
|
44 | 44 | ]); |
45 | 45 | |
46 | 46 | $app->LoadLangPack($langset); |
@@ -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; |