@@ -69,7 +69,7 @@ |
||
69 | 69 | * @param string $name |
70 | 70 | * @return RouteMatcher|null |
71 | 71 | */ |
72 | - public function get(string $name):?RouteMatcher |
|
72 | + public function get(string $name): ?RouteMatcher |
|
73 | 73 | { |
74 | 74 | return $this->collection[$name] ?? null; |
75 | 75 | } |
@@ -10,13 +10,13 @@ |
||
10 | 10 | { |
11 | 11 | public function log($level, string $message, array $context = []) |
12 | 12 | { |
13 | - print date('Y-m-d H:i:s') .' ' . $this->interpolate($message, $context) . PHP_EOL; |
|
13 | + print date('Y-m-d H:i:s').' '.$this->interpolate($message, $context).PHP_EOL; |
|
14 | 14 | } |
15 | 15 | public function interpolate(string $message, array $context) |
16 | 16 | { |
17 | 17 | $replace = []; |
18 | 18 | foreach ($context as $key => $val) { |
19 | - $replace['{' . $key . '}'] = $val; |
|
19 | + $replace['{'.$key.'}'] = $val; |
|
20 | 20 | } |
21 | 21 | return strtr($message, $replace); |
22 | 22 | } |
@@ -6,10 +6,10 @@ |
||
6 | 6 | trait LoaderAwareTrait |
7 | 7 | { |
8 | 8 | /** |
9 | - * 加载器 |
|
10 | - * |
|
11 | - * @var Loader |
|
12 | - */ |
|
9 | + * 加载器 |
|
10 | + * |
|
11 | + * @var Loader |
|
12 | + */ |
|
13 | 13 | protected $loader; |
14 | 14 | |
15 | 15 |
@@ -13,12 +13,12 @@ discard block |
||
13 | 13 | */ |
14 | 14 | protected static $mimes = [ |
15 | 15 | # Image Type |
16 | - 'jpe' => 'image/jpeg' , |
|
17 | - 'jpeg' => 'image/jpeg' , |
|
18 | - 'jpg' => 'image/jpeg' , |
|
19 | - 'svg' => 'image/svg+xml' , |
|
20 | - 'png' => 'image/png' , |
|
21 | - 'gif' => 'image/gif' , |
|
16 | + 'jpe' => 'image/jpeg', |
|
17 | + 'jpeg' => 'image/jpeg', |
|
18 | + 'jpg' => 'image/jpeg', |
|
19 | + 'svg' => 'image/svg+xml', |
|
20 | + 'png' => 'image/png', |
|
21 | + 'gif' => 'image/gif', |
|
22 | 22 | 'ico' => 'image/x-icon', |
23 | 23 | 'webp' => 'image/webp', |
24 | 24 | |
@@ -26,8 +26,8 @@ discard block |
||
26 | 26 | 'js' => 'text/javascript', |
27 | 27 | 'css' => 'text/css', |
28 | 28 | 'txt' => 'text/plain', |
29 | - 'html' => 'text/html' , |
|
30 | - 'csv' => 'text/csv' , |
|
29 | + 'html' => 'text/html', |
|
30 | + 'csv' => 'text/csv', |
|
31 | 31 | 'xml' => 'text/xml', |
32 | 32 | |
33 | 33 | # App type |
@@ -39,8 +39,8 @@ discard block |
||
39 | 39 | |
40 | 40 | # Archive |
41 | 41 | 'zip' => 'application/zip', |
42 | - 'gtar' => 'application/x-gtar' , |
|
43 | - 'gz' => 'application/x-gzip' , |
|
42 | + 'gtar' => 'application/x-gtar', |
|
43 | + 'gz' => 'application/x-gzip', |
|
44 | 44 | '7z' => 'application/x-7z-compressed', |
45 | 45 | 'rar' => 'application/x-rar-compressed', |
46 | 46 |
@@ -234,7 +234,7 @@ |
||
234 | 234 | */ |
235 | 235 | public function getQuery(?string $name = null, $default = null) |
236 | 236 | { |
237 | - return $name === null ? $this->query:$this->query[$name] ?? $default; |
|
237 | + return $name === null ? $this->query : $this->query[$name] ?? $default; |
|
238 | 238 | } |
239 | 239 | |
240 | 240 | /** |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | * |
17 | 17 | * @var array |
18 | 18 | */ |
19 | - protected $namespace = [ __NAMESPACE__ ]; |
|
19 | + protected $namespace = [__NAMESPACE__]; |
|
20 | 20 | |
21 | 21 | /** |
22 | 22 | * 包含路径 |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | */ |
34 | 34 | public static function realName(string $name):string |
35 | 35 | { |
36 | - return str_replace(['.','/'], '\\', $name); |
|
36 | + return str_replace(['.', '/'], '\\', $name); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | /** |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | * @param string $name |
43 | 43 | * @return string|null |
44 | 44 | */ |
45 | - public static function realPath(string $name):?string |
|
45 | + public static function realPath(string $name): ?string |
|
46 | 46 | { |
47 | 47 | return Path::format($name); |
48 | 48 | } |
@@ -70,7 +70,7 @@ |
||
70 | 70 | } |
71 | 71 | $zip = new ZipArchive; |
72 | 72 | if ($zip->open($path, ZipArchive::CHECKCONS)) { |
73 | - $unzipPath = $unpackPath.'/'. pathinfo($path, PATHINFO_FILENAME) .'-'.substr(md5_file($path), 0, 8); |
|
73 | + $unzipPath = $unpackPath.'/'.pathinfo($path, PATHINFO_FILENAME).'-'.substr(md5_file($path), 0, 8); |
|
74 | 74 | $zip->extractTo($unzipPath); |
75 | 75 | $zip->close(); |
76 | 76 | return PathResolver::resolve($unzipPath.'/module'); |
@@ -25,7 +25,7 @@ |
||
25 | 25 | <div class="footer"> |
26 | 26 | <?php if (defined('SUDA_START_TIME') && defined('SUDA_START_MEMORY')): ?> |
27 | 27 | <?php |
28 | - $mem = memory_get_usage() - SUDA_START_MEMORY ; |
|
28 | + $mem = memory_get_usage() - SUDA_START_MEMORY ; |
|
29 | 29 | $human = array('B', 'KB', 'MB', 'GB', 'TB'); |
30 | 30 | $pos = 0; |
31 | 31 | while ($mem >= 1024) { |
@@ -25,14 +25,14 @@ |
||
25 | 25 | <div class="footer"> |
26 | 26 | <?php if (defined('SUDA_START_TIME') && defined('SUDA_START_MEMORY')): ?> |
27 | 27 | <?php |
28 | - $mem = memory_get_usage() - SUDA_START_MEMORY ; |
|
28 | + $mem = memory_get_usage() - SUDA_START_MEMORY; |
|
29 | 29 | $human = array('B', 'KB', 'MB', 'GB', 'TB'); |
30 | 30 | $pos = 0; |
31 | 31 | while ($mem >= 1024) { |
32 | 32 | $mem /= 1024; |
33 | 33 | $pos++; |
34 | 34 | } |
35 | - $memory_usage = round($mem, 5) .' '. $human[$pos]; ?> |
|
35 | + $memory_usage = round($mem, 5).' '.$human[$pos]; ?> |
|
36 | 36 | |
37 | 37 | <div class="footer-item">Memory Cost: <?php echo $memory_usage; ?></div> |
38 | 38 | <div class="footer-item">Time Cost: <?php echo number_format(microtime(true) - SUDA_START_TIME, 5); ?>s</div> |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | * @param mixed $default |
35 | 35 | * @return mixed |
36 | 36 | */ |
37 | - public function get(string $name=null, $default=null); |
|
37 | + public function get(string $name = null, $default = null); |
|
38 | 38 | |
39 | 39 | /** |
40 | 40 | * 删除一个或者全部Session数据 |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | * @param string|null $name |
43 | 43 | * @return bool |
44 | 44 | */ |
45 | - public function delete(?string $name=null):bool; |
|
45 | + public function delete(?string $name = null):bool; |
|
46 | 46 | |
47 | 47 | /** |
48 | 48 | * 检测是否存在Session |