@@ -88,10 +88,10 @@ discard block |
||
88 | 88 | */ |
89 | 89 | protected function sendMultipleFileByRange(Response $response, array $ranges) |
90 | 90 | { |
91 | - $separates = 'multiple_range_' . base64_encode(md5(uniqid(), true)); |
|
92 | - $response->setHeader('content-type', 'multipart/byteranges; boundary=' . $separates); |
|
91 | + $separates = 'multiple_range_'.base64_encode(md5(uniqid(), true)); |
|
92 | + $response->setHeader('content-type', 'multipart/byteranges; boundary='.$separates); |
|
93 | 93 | foreach ($ranges as $range) { |
94 | - $response->write('--' . $separates . "\r\n"); |
|
94 | + $response->write('--'.$separates."\r\n"); |
|
95 | 95 | $this->sendMultipleRangePart($response, $range); |
96 | 96 | $this->sendFileByRange($response, $range); |
97 | 97 | $response->write("\r\n"); |
@@ -138,8 +138,8 @@ discard block |
||
138 | 138 | */ |
139 | 139 | protected function sendMultipleRangePart(Response $response, array $range) |
140 | 140 | { |
141 | - $response->write('Content-Type: ' . $this->mime . "\r\n"); |
|
142 | - $response->write('Content-Range: ' . $this->getRangeHeader($range) . "\r\n\r\n"); |
|
141 | + $response->write('Content-Type: '.$this->mime."\r\n"); |
|
142 | + $response->write('Content-Range: '.$this->getRangeHeader($range)."\r\n\r\n"); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | /** |
@@ -304,15 +304,15 @@ |
||
304 | 304 | if ($this->expire !== 0) { |
305 | 305 | $time = $this->fullTime ? $this->expire : time() + $this->expire; |
306 | 306 | $dateTime = DateTime::createFromFormat('U', $time, new DateTimeZone('GMT')); |
307 | - $cookie .= '; Expires=' . str_replace('+0000', '', $dateTime->format('D, d M Y H:i:s T')); |
|
307 | + $cookie .= '; Expires='.str_replace('+0000', '', $dateTime->format('D, d M Y H:i:s T')); |
|
308 | 308 | } |
309 | 309 | |
310 | 310 | if ($this->domain !== null) { |
311 | - $cookie .= '; Domain=' . $this->domain; |
|
311 | + $cookie .= '; Domain='.$this->domain; |
|
312 | 312 | } |
313 | 313 | |
314 | 314 | if ($this->path) { |
315 | - $cookie .= '; Path=' . $this->path; |
|
315 | + $cookie .= '; Path='.$this->path; |
|
316 | 316 | } |
317 | 317 | |
318 | 318 | if ($this->secure) { |
@@ -106,10 +106,10 @@ discard block |
||
106 | 106 | private function packLogFile() |
107 | 107 | { |
108 | 108 | $logFile = $this->latest; |
109 | - $path = preg_replace('/[\\\\]+/', '/', $this->getConfig('save-zip-path') .'/'.date('Y-m-d').'.zip'); |
|
109 | + $path = preg_replace('/[\\\\]+/', '/', $this->getConfig('save-zip-path').'/'.date('Y-m-d').'.zip'); |
|
110 | 110 | $zip = $this->getZipArchive($path); |
111 | 111 | if ($zip !== null) { |
112 | - if ($zip->addFile($logFile, date('Y-m-d'). '-'. $zip->numFiles .'.log')) { |
|
112 | + if ($zip->addFile($logFile, date('Y-m-d').'-'.$zip->numFiles.'.log')) { |
|
113 | 113 | array_push($this->removeFiles, $logFile); |
114 | 114 | } |
115 | 115 | if (is_dir($this->getConfig('save-dump-path'))) { |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | if (is_file($logFile) && file_exists($logFile)) { |
129 | 129 | rename( |
130 | 130 | $logFile, |
131 | - $this->getConfig('save-path') . '/' . date('Y-m-d'). '-'. substr(md5_file($logFile), 0, 8).'.log' |
|
131 | + $this->getConfig('save-path').'/'.date('Y-m-d').'-'.substr(md5_file($logFile), 0, 8).'.log' |
|
132 | 132 | ); |
133 | 133 | } |
134 | 134 | } |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | } elseif (null === $val) { |
242 | 242 | $val = 'null'; |
243 | 243 | } |
244 | - $replace['{' . $key . '}'] = $val; |
|
244 | + $replace['{'.$key.'}'] = $val; |
|
245 | 245 | } |
246 | 246 | return strtr($message, $replace); |
247 | 247 | } |
@@ -164,7 +164,7 @@ |
||
164 | 164 | private function sendWarningIfy(string $name) |
165 | 165 | { |
166 | 166 | if ($this->isSend()) { |
167 | - trigger_error($name .': response has been send', E_USER_WARNING); |
|
167 | + trigger_error($name.': response has been send', E_USER_WARNING); |
|
168 | 168 | } |
169 | 169 | } |
170 | 170 | } |
@@ -47,7 +47,7 @@ |
||
47 | 47 | public function status(int $statusCode) |
48 | 48 | { |
49 | 49 | $this->response->status($statusCode); |
50 | - $this->status = $statusCode; |
|
50 | + $this->status = $statusCode; |
|
51 | 51 | return $this; |
52 | 52 | } |
53 | 53 |
@@ -2,13 +2,13 @@ |
||
2 | 2 | $host = $argv[1] ?? '127.0.0.1:8080'; |
3 | 3 | list($ip, $port) = explode(':', $host); |
4 | 4 | |
5 | -define('SUDA_APP', __DIR__ . '/app'); |
|
6 | -define('SUDA_DATA', __DIR__ . '/data'); |
|
7 | -define('SUDA_SYSTEM', __DIR__ . '/suda'); |
|
5 | +define('SUDA_APP', __DIR__.'/app'); |
|
6 | +define('SUDA_DATA', __DIR__.'/data'); |
|
7 | +define('SUDA_SYSTEM', __DIR__.'/suda'); |
|
8 | 8 | define('SUDA_PUBLIC', __DIR__); |
9 | 9 | define('SUDA_DEBUG', true); |
10 | 10 | define('SUDA_DEBUG_LEVEL', 'info'); |
11 | -define('SUDA_APP_MANIFEST', SUDA_APP . '/manifest'); |
|
11 | +define('SUDA_APP_MANIFEST', SUDA_APP.'/manifest'); |
|
12 | 12 | |
13 | 13 | // 设置IP或者端口 |
14 | 14 | define('SUDA_SWOOLE_IP', $ip); |
@@ -7,12 +7,12 @@ |
||
7 | 7 | use suda\application\builder\ApplicationBuilder; |
8 | 8 | use suda\framework\http\HTTPResponse as Response; |
9 | 9 | |
10 | -require_once __DIR__ .'/loader.php'; |
|
10 | +require_once __DIR__.'/loader.php'; |
|
11 | 11 | |
12 | 12 | // 初始化系统加载器 |
13 | 13 | $loader = new Loader; |
14 | 14 | $loader->register(); |
15 | -$loader->addIncludePath(SUDA_SYSTEM .'/src', 'suda'); |
|
15 | +$loader->addIncludePath(SUDA_SYSTEM.'/src', 'suda'); |
|
16 | 16 | // 初始化数据目录 |
17 | 17 | defined('SUDA_DATA') or define('SUDA_DATA', Path::toAbsolutePath('~/data')); |
18 | 18 | defined('SUDA_APP_MANIFEST') or define('SUDA_APP_MANIFEST', SUDA_APP.'/manifest'); |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -require_once __DIR__ . '/loader.php'; |
|
2 | +require_once __DIR__.'/loader.php'; |
|
3 | 3 | |
4 | 4 | use Swoole\Http\Server; |
5 | 5 | use suda\swoole\Request; |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | // 初始化系统加载器 |
17 | 17 | $loader = new Loader; |
18 | 18 | $loader->register(); |
19 | -$loader->addIncludePath(SUDA_SYSTEM . '/src', 'suda'); |
|
19 | +$loader->addIncludePath(SUDA_SYSTEM.'/src', 'suda'); |
|
20 | 20 | |
21 | 21 | // 创建应用 |
22 | 22 | $application = ApplicationBuilder::build($loader, SUDA_APP, SUDA_APP_MANIFEST, SUDA_DATA); |
@@ -31,9 +31,9 @@ discard block |
||
31 | 31 | $logger = new FileLogger( |
32 | 32 | [ |
33 | 33 | 'log-level' => SUDA_DEBUG_LEVEL, |
34 | - 'save-path' => $application->getDataPath() . '/logs', |
|
35 | - 'save-zip-path' => $application->getDataPath() . '/logs/zip', |
|
36 | - 'save-dump-path' => $application->getDataPath() . '/logs/dump', |
|
34 | + 'save-path' => $application->getDataPath().'/logs', |
|
35 | + 'save-zip-path' => $application->getDataPath().'/logs/zip', |
|
36 | + 'save-dump-path' => $application->getDataPath().'/logs/dump', |
|
37 | 37 | 'log-format' => '%message%', |
38 | 38 | ] |
39 | 39 | ); |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | |
44 | 44 | $http = new Server(SUDA_SWOOLE_IP, SUDA_SWOOLE_PORT); |
45 | 45 | |
46 | -$http->on('request', function ($request, $response) use ($application, $logger) { |
|
46 | +$http->on('request', function($request, $response) use ($application, $logger) { |
|
47 | 47 | $application->getDebug()->applyConfig([ |
48 | 48 | 'start-time' => microtime(true), |
49 | 49 | 'start-memory' => memory_get_usage(), |