@@ -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 |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | * @param mixed $default |
| 26 | 26 | * @return mixed |
| 27 | 27 | */ |
| 28 | - public function get(string $name, $default=null); |
|
| 28 | + public function get(string $name, $default = null); |
|
| 29 | 29 | |
| 30 | 30 | /** |
| 31 | 31 | * 删除一个或者全部Cache数据 |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | * @param string|null $name |
| 34 | 34 | * @return bool |
| 35 | 35 | */ |
| 36 | - public function delete(?string $name=null):bool; |
|
| 36 | + public function delete(?string $name = null):bool; |
|
| 37 | 37 | |
| 38 | 38 | /** |
| 39 | 39 | * 检测是否存在Cache |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | |
| 66 | 66 | if (is_string($id = $request->getCookie($name))) { |
| 67 | 67 | session_id($id); |
| 68 | - }else{ |
|
| 68 | + } else { |
|
| 69 | 69 | $id = md5($path.$request->getRemoteAddr().uniqid()); |
| 70 | 70 | session_id($id); |
| 71 | 71 | } |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | public function get(string $name = null, $default = null) |
| 101 | 101 | { |
| 102 | 102 | if ($name !== null) { |
| 103 | - return $this->has($name) ?$_SESSION[$name]:$default; |
|
| 103 | + return $this->has($name) ? $_SESSION[$name] : $default; |
|
| 104 | 104 | } else { |
| 105 | 105 | return $_SESSION; |
| 106 | 106 | } |
@@ -65,7 +65,7 @@ |
||
| 65 | 65 | |
| 66 | 66 | if (is_string($id = $request->getCookie($name))) { |
| 67 | 67 | session_id($id); |
| 68 | - }else{ |
|
| 68 | + } else{ |
|
| 69 | 69 | $id = md5($path.$request->getRemoteAddr().uniqid()); |
| 70 | 70 | session_id($id); |
| 71 | 71 | } |
@@ -22,7 +22,7 @@ |
||
| 22 | 22 | { |
| 23 | 23 | $content = $this->content; |
| 24 | 24 | $response->setType($content->getExtension()); |
| 25 | - $response->setHeader('Content-Disposition', 'attachment;filename="' . $content->getBasename().'"'); |
|
| 25 | + $response->setHeader('Content-Disposition', 'attachment;filename="'.$content->getBasename().'"'); |
|
| 26 | 26 | $response->setHeader('Cache-Control', 'max-age=0'); |
| 27 | 27 | return new DataStream($content); |
| 28 | 28 | } |
@@ -9,10 +9,10 @@ |
||
| 9 | 9 | class StringStream implements Stream |
| 10 | 10 | { |
| 11 | 11 | /** |
| 12 | - * 设置偏移 |
|
| 13 | - * |
|
| 14 | - * @var int |
|
| 15 | - */ |
|
| 12 | + * 设置偏移 |
|
| 13 | + * |
|
| 14 | + * @var int |
|
| 15 | + */ |
|
| 16 | 16 | protected $offset = 0; |
| 17 | 17 | |
| 18 | 18 | /** |
@@ -20,10 +20,10 @@ |
||
| 20 | 20 | protected $tag = [ |
| 21 | 21 | 'raw' => ['{{!', '}}', '<?php echo $code; ?>'], |
| 22 | 22 | 'comment' => ['{--', '--}', '<?php /* $code */ ?>'], |
| 23 | - 'echo' => [ '{{', '}}', '<?php echo htmlspecialchars($this->application->_($code), ENT_SUBSTITUTE | ENT_QUOTES | ENT_HTML5); ?>' ], |
|
| 23 | + 'echo' => ['{{', '}}', '<?php echo htmlspecialchars($this->application->_($code), ENT_SUBSTITUTE | ENT_QUOTES | ENT_HTML5); ?>'], |
|
| 24 | 24 | 'string' => ['{=', '}', '<?php echo htmlspecialchars($this->application->_("$code"), ENT_SUBSTITUTE | ENT_QUOTES | ENT_HTML5); ?>'], |
| 25 | - 'raw-string' => ['@{', '}', '<?php echo htmlspecialchars($code, ENT_SUBSTITUTE | ENT_QUOTES | ENT_HTML5); ?>' ], |
|
| 26 | - 'event' => ['{:', '}', '<?php $this->application->event()->exec("$code", [$this]); ?>' ], |
|
| 25 | + 'raw-string' => ['@{', '}', '<?php echo htmlspecialchars($code, ENT_SUBSTITUTE | ENT_QUOTES | ENT_HTML5); ?>'], |
|
| 26 | + 'event' => ['{:', '}', '<?php $this->application->event()->exec("$code", [$this]); ?>'], |
|
| 27 | 27 | ]; |
| 28 | 28 | |
| 29 | 29 | public function __construct() |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | * |
| 12 | 12 | * @var array |
| 13 | 13 | */ |
| 14 | - private $locales=[]; |
|
| 14 | + private $locales = []; |
|
| 15 | 15 | |
| 16 | 16 | /** |
| 17 | 17 | * 包含本地化语言数组 |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | */ |
| 50 | 50 | public static function format(string $string, array $param) |
| 51 | 51 | { |
| 52 | - return preg_replace_callback('/(?<!\$)\$(\{)?(\d+|\w+?\b)(?(1)\})/', function ($match) use ($param) { |
|
| 52 | + return preg_replace_callback('/(?<!\$)\$(\{)?(\d+|\w+?\b)(?(1)\})/', function($match) use ($param) { |
|
| 53 | 53 | $key = $match[2]; |
| 54 | 54 | if (array_key_exists($key, $param)) { |
| 55 | 55 | return strval($param[$key]); |