@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | { |
43 | 43 | $this->routes = new RouteCollection; |
44 | 44 | $this->runnable = []; |
45 | - $this->default = new Runnable([__CLASS__ , 'defaultResponse']); |
|
45 | + $this->default = new Runnable([__CLASS__, 'defaultResponse']); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | /** |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | * @param boolean $allowQuery |
290 | 290 | * @return string|null |
291 | 291 | */ |
292 | - public function create(string $name, array $parameter, bool $allowQuery = true):?string |
|
292 | + public function create(string $name, array $parameter, bool $allowQuery = true): ?string |
|
293 | 293 | { |
294 | 294 | if ($matcher = $this->routes->get($name)) { |
295 | 295 | return UriMatcher::buildUri($matcher->getMatcher(), $parameter, $allowQuery); |
@@ -19,9 +19,9 @@ |
||
19 | 19 | } |
20 | 20 | |
21 | 21 | use FileHelper { |
22 | - delete as protected deleteFile; |
|
23 | - FileHelper::copy insteadof DirectoryHelper; |
|
24 | - FileHelper::move insteadof DirectoryHelper; |
|
22 | + delete as protected deleteFile; |
|
23 | + FileHelper::copy insteadof DirectoryHelper; |
|
24 | + FileHelper::move insteadof DirectoryHelper; |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
@@ -15,13 +15,13 @@ |
||
15 | 15 | |
16 | 16 | protected function parseStatic($content) |
17 | 17 | { |
18 | - $content = strlen(trim($content)) === 0 ?'()':$content; |
|
18 | + $content = strlen(trim($content)) === 0 ? '()' : $content; |
|
19 | 19 | return '<?php echo $this->getStaticModulePrefix'.$content.'; ?>'; |
20 | 20 | } |
21 | 21 | |
22 | 22 | protected function parseFile($content) |
23 | 23 | { |
24 | - $content = strlen(trim($content)) === 0 ?'()':$content; |
|
24 | + $content = strlen(trim($content)) === 0 ? '()' : $content; |
|
25 | 25 | return '<?php echo $this->getModulePrefix'.$content.'; ?>'; |
26 | 26 | } |
27 | 27 | } |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | protected function getModuleStaticOutpath(?string $module) |
97 | 97 | { |
98 | 98 | $config = $this->getModuleConfig($module); |
99 | - $path = $config['assets-path'].'/'. $this->getModuleUriName($module) .'/'.$config['static']; |
|
99 | + $path = $config['assets-path'].'/'.$this->getModuleUriName($module).'/'.$config['static']; |
|
100 | 100 | FileSystem::make($path); |
101 | 101 | return $path; |
102 | 102 | } |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | } |
125 | 125 | $this->prepareStaticModuleSource($module); |
126 | 126 | $config = TemplateUtil::getConfig($this->application, $module); |
127 | - return $this->getModuleStaticAssetRoot($module) .'/'.$this->getModuleUriName($module). '/'.$config['static']; |
|
127 | + return $this->getModuleStaticAssetRoot($module).'/'.$this->getModuleUriName($module).'/'.$config['static']; |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | protected function getModulePrefix(?string $module = null) |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | if ($module === null) { |
133 | 133 | $module = $this->module; |
134 | 134 | } |
135 | - return $this->getModuleAssetRoot($module) .'/'.$this->getModuleUriName($module); |
|
135 | + return $this->getModuleAssetRoot($module).'/'.$this->getModuleUriName($module); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | protected function getModuleAssetRoot(?string $module) |
@@ -24,7 +24,7 @@ |
||
24 | 24 | |
25 | 25 | public function packValue(?string $matched) |
26 | 26 | { |
27 | - return $matched ? urlencode($matched): ''; |
|
27 | + return $matched ? urlencode($matched) : ''; |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | /** |
@@ -230,7 +230,7 @@ |
||
230 | 230 | protected function closeOutputBuffer(bool $flush) |
231 | 231 | { |
232 | 232 | while (ob_get_level() > 0) { |
233 | - $flush?ob_end_flush():ob_end_clean(); |
|
233 | + $flush ?ob_end_flush() : ob_end_clean(); |
|
234 | 234 | } |
235 | 235 | } |
236 | 236 |
@@ -6,12 +6,12 @@ |
||
6 | 6 | use suda\framework\http\HTTPRequest; |
7 | 7 | use suda\application\builder\ApplicationBuilder; |
8 | 8 | |
9 | -require_once __DIR__ .'/loader.php'; |
|
9 | +require_once __DIR__.'/loader.php'; |
|
10 | 10 | |
11 | 11 | // 初始化系统加载器 |
12 | 12 | $loader = new Loader; |
13 | 13 | $loader->register(); |
14 | -$loader->addIncludePath(SUDA_SYSTEM .'/src', 'suda'); |
|
14 | +$loader->addIncludePath(SUDA_SYSTEM.'/src', 'suda'); |
|
15 | 15 | // 初始化数据目录 |
16 | 16 | defined('SUDA_DATA') or define('SUDA_DATA', Path::toAbsolutePath('~/data')); |
17 | 17 | $application = ApplicationBuilder::build($loader, SUDA_APP, SUDA_DATA); |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | |
38 | 38 | public function __construct($file) |
39 | 39 | { |
40 | - $this->file = $file instanceof SplFileObject? $file : new SplFileObject($file); |
|
40 | + $this->file = $file instanceof SplFileObject ? $file : new SplFileObject($file); |
|
41 | 41 | $this->mime = MimeType::getMimeType($this->file->getExtension()); |
42 | 42 | } |
43 | 43 | |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | protected function sendMultipleRangePart(Response $response, array $range) |
130 | 130 | { |
131 | 131 | $response->write('Content-Type: '.$this->mime."\r\n"); |
132 | - $response->write('Content-Range: '.$this->getRangeHeader($range) ."\r\n\r\n"); |
|
132 | + $response->write('Content-Range: '.$this->getRangeHeader($range)."\r\n\r\n"); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | /** |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | * @param string $range |
189 | 189 | * @return array |
190 | 190 | */ |
191 | - protected function parseRange(string $range):?array |
|
191 | + protected function parseRange(string $range): ?array |
|
192 | 192 | { |
193 | 193 | $range = trim($range); |
194 | 194 | if (strrpos($range, '-') === strlen($range) - 1) { |
@@ -200,9 +200,9 @@ discard block |
||
200 | 200 | list($start, $end) = explode('-', $range, 2); |
201 | 201 | $length = intval($end - $start); |
202 | 202 | if ($length <= 0) { |
203 | - return ['start' => intval($start) , 'end' => $this->file->getSize() - 1 ]; |
|
203 | + return ['start' => intval($start), 'end' => $this->file->getSize() - 1]; |
|
204 | 204 | } |
205 | - return ['start' => intval($start) , 'end' => intval($end) ]; |
|
205 | + return ['start' => intval($start), 'end' => intval($end)]; |
|
206 | 206 | } |
207 | 207 | return null; |
208 | 208 | } |
@@ -59,7 +59,7 @@ |
||
59 | 59 | * @return DataAccess |
60 | 60 | * @throws ReflectionException |
61 | 61 | */ |
62 | - public static function new(string $object, ?Middleware $middleware = null):DataAccess |
|
62 | + public static function new(string $object, ?Middleware $middleware = null) : DataAccess |
|
63 | 63 | { |
64 | 64 | return new self($object, $middleware); |
65 | 65 | } |