@@ -14,12 +14,12 @@ |
||
| 14 | 14 | * @param string $path 目标路径 |
| 15 | 15 | * @return string|null 返回格式化结果,如果路径不存在则返回NULL |
| 16 | 16 | */ |
| 17 | - public static function format(string $path):?string |
|
| 17 | + public static function format(string $path): ?string |
|
| 18 | 18 | { |
| 19 | - return static::existCharset($path, ['GBK','GB2312','BIG5']); |
|
| 19 | + return static::existCharset($path, ['GBK', 'GB2312', 'BIG5']); |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | - public static function existCharset(string $path, array $charset):?string |
|
| 22 | + public static function existCharset(string $path, array $charset): ?string |
|
| 23 | 23 | { |
| 24 | 24 | $abspath = static::toAbsolutePath($path); |
| 25 | 25 | if (static::existCase($abspath)) { |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | */ |
| 26 | 26 | public static function delete(string $filename):bool |
| 27 | 27 | { |
| 28 | - if (($path=Path::format($filename)) !== null) { |
|
| 28 | + if (($path = Path::format($filename)) !== null) { |
|
| 29 | 29 | if (!is_writable($path)) { |
| 30 | 30 | return false; |
| 31 | 31 | } |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | */ |
| 44 | 44 | public static function move(string $src, string $dest):bool |
| 45 | 45 | { |
| 46 | - if (($path=Path::format($src)) !== null && is_writable(dirname($dest))) { |
|
| 46 | + if (($path = Path::format($src)) !== null && is_writable(dirname($dest))) { |
|
| 47 | 47 | return rename($path, $dest); |
| 48 | 48 | } |
| 49 | 49 | return false; |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | */ |
| 59 | 59 | public static function copy(string $src, string $dest):bool |
| 60 | 60 | { |
| 61 | - if (($path=Path::format($src)) !== null && is_writable(dirname($dest))) { |
|
| 61 | + if (($path = Path::format($src)) !== null && is_writable(dirname($dest))) { |
|
| 62 | 62 | return copy($path, $dest); |
| 63 | 63 | } |
| 64 | 64 | return false; |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | */ |
| 75 | 75 | public function put(string $filename, string $content, int $flags = 0):bool |
| 76 | 76 | { |
| 77 | - if (is_writeable(dirname($filename)) && ($path=Path::format($filename)) !== null) { |
|
| 77 | + if (is_writeable(dirname($filename)) && ($path = Path::format($filename)) !== null) { |
|
| 78 | 78 | return file_put_contents($path, $content, $flags) > 0; |
| 79 | 79 | } |
| 80 | 80 | return false; |
@@ -86,9 +86,9 @@ discard block |
||
| 86 | 86 | * @param string $name |
| 87 | 87 | * @return string|null |
| 88 | 88 | */ |
| 89 | - public function get(string $filename):?string |
|
| 89 | + public function get(string $filename): ?string |
|
| 90 | 90 | { |
| 91 | - if (is_readable($filename) && ($path=Path::format($filename)) !== null) { |
|
| 91 | + if (is_readable($filename) && ($path = Path::format($filename)) !== null) { |
|
| 92 | 92 | return file_get_contents($path); |
| 93 | 93 | } |
| 94 | 94 | return null; |