@@ -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 |
@@ -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 | } |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | */ |
27 | 27 | public function __construct($resource = []) |
28 | 28 | { |
29 | - $this->resource = is_array($resource)?$resource:[$resource]; |
|
29 | + $this->resource = is_array($resource) ? $resource : [$resource]; |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | /** |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | * @param string $limitPath 父级溢出 |
67 | 67 | * @return string|null |
68 | 68 | */ |
69 | - public function getResourcePath(string $path, string $limitPath = null):?string |
|
69 | + public function getResourcePath(string $path, string $limitPath = null): ?string |
|
70 | 70 | { |
71 | 71 | foreach ($this->resource as $root) { |
72 | 72 | $target = $root.'/'.$path; |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | * @param string $path |
85 | 85 | * @return string|null |
86 | 86 | */ |
87 | - public function getConfigResourcePath(string $path):?string |
|
87 | + public function getConfigResourcePath(string $path): ?string |
|
88 | 88 | { |
89 | 89 | foreach ($this->resource as $root) { |
90 | 90 | if ($target = PathResolver::resolve($root.'/'.$path)) { |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | * @param string $name |
78 | 78 | * @return Module|null |
79 | 79 | */ |
80 | - public function find(string $name):?Module |
|
80 | + public function find(string $name): ?Module |
|
81 | 81 | { |
82 | 82 | return $this->module->get($name); |
83 | 83 | } |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | $this->modulePaths[] = Resource::getPathByRelativePath($path, $this->path); |
112 | 112 | } |
113 | 113 | } else { |
114 | - $this->modulePaths = [ Resource::getPathByRelativePath('modules', $this->path) ]; |
|
114 | + $this->modulePaths = [Resource::getPathByRelativePath('modules', $this->path)]; |
|
115 | 115 | } |
116 | 116 | } |
117 | 117 | |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | */ |
135 | 135 | protected function className(string $name) |
136 | 136 | { |
137 | - return str_replace(['.','/'], '\\', $name); |
|
137 | + return str_replace(['.', '/'], '\\', $name); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | /** |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | * @param array|Config $extra |
112 | 112 | * @return array|null |
113 | 113 | */ |
114 | - public static function loadConfig(string $path, $extra = []):?array |
|
114 | + public static function loadConfig(string $path, $extra = []): ?array |
|
115 | 115 | { |
116 | 116 | if (!file_exists($path)) { |
117 | 117 | $path = PathResolver::resolve($path); |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | } |
122 | 122 | if ($path) { |
123 | 123 | $ext = strtolower(pathinfo($path, PATHINFO_EXTENSION)); |
124 | - if (in_array($ext, ['yaml','yml','json','php','ini'])) { |
|
124 | + if (in_array($ext, ['yaml', 'yml', 'json', 'php', 'ini'])) { |
|
125 | 125 | return ContentLoader::{'load'.ucfirst($ext)}($path, $extra); |
126 | 126 | } |
127 | 127 | return ContentLoader::loadJson($path, $extra); |