@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | * @param string $name |
57 | 57 | * @return string|null |
58 | 58 | */ |
59 | - public static function get(string $filename):?string; |
|
59 | + public static function get(string $filename): ?string; |
|
60 | 60 | |
61 | 61 | |
62 | 62 | /** |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | * @param boolean $full |
78 | 78 | * @return \Iterator |
79 | 79 | */ |
80 | - public static function readFiles(string $path, bool $recursive=false, ?string $regex=null, bool $full=true, int $mode = RecursiveIteratorIterator::LEAVES_ONLY) : \Iterator; |
|
80 | + public static function readFiles(string $path, bool $recursive = false, ?string $regex = null, bool $full = true, int $mode = RecursiveIteratorIterator::LEAVES_ONLY) : \Iterator; |
|
81 | 81 | |
82 | 82 | /** |
83 | 83 | * 读目录下文件夹 |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | * @param boolean $full |
89 | 89 | * @return \Iterator |
90 | 90 | */ |
91 | - public static function readDirs(string $path, bool $recursive=false, ?string $regex=null, bool $full=false, int $mode = RecursiveIteratorIterator::LEAVES_ONLY): \Iterator; |
|
91 | + public static function readDirs(string $path, bool $recursive = false, ?string $regex = null, bool $full = false, int $mode = RecursiveIteratorIterator::LEAVES_ONLY): \Iterator; |
|
92 | 92 | |
93 | 93 | /** |
94 | 94 | * 读目录,包括文件,文件夹 |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | * @param boolean $full |
100 | 100 | * @return \Iterator |
101 | 101 | */ |
102 | - public static function read(string $path, bool $recursive=false, ?string $regex=null, bool $full=true, int $mode = RecursiveIteratorIterator::LEAVES_ONLY): \Iterator; |
|
102 | + public static function read(string $path, bool $recursive = false, ?string $regex = null, bool $full = true, int $mode = RecursiveIteratorIterator::LEAVES_ONLY): \Iterator; |
|
103 | 103 | |
104 | 104 | /** |
105 | 105 | * 截断部分目录 |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | * @param boolean $move |
120 | 120 | * @return boolean |
121 | 121 | */ |
122 | - public static function copyDir(string $path, string $toPath, ?string $regex=null, bool $move = false):bool; |
|
122 | + public static function copyDir(string $path, string $toPath, ?string $regex = null, bool $move = false):bool; |
|
123 | 123 | |
124 | 124 | /** |
125 | 125 | * 移动文件夹 |
@@ -129,5 +129,5 @@ discard block |
||
129 | 129 | * @param string|null $regex |
130 | 130 | * @return boolean |
131 | 131 | */ |
132 | - public static function moveDir(string $path, string $toPath, ?string $regex=null):bool; |
|
132 | + public static function moveDir(string $path, string $toPath, ?string $regex = null):bool; |
|
133 | 133 | } |
@@ -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 |
@@ -34,7 +34,7 @@ |
||
34 | 34 | */ |
35 | 35 | public static function delete(string $path):bool |
36 | 36 | { |
37 | - if (($path=Path::format($path)) !== null) { |
|
37 | + if (($path = Path::format($path)) !== null) { |
|
38 | 38 | if (is_file($path)) { |
39 | 39 | return static::deleteFile($path); |
40 | 40 | } |
@@ -15,14 +15,14 @@ discard block |
||
15 | 15 | * |
16 | 16 | * @var array |
17 | 17 | */ |
18 | - protected $namespace=[ __NAMESPACE__ ]; |
|
18 | + protected $namespace = [__NAMESPACE__]; |
|
19 | 19 | |
20 | 20 | /** |
21 | 21 | * 包含路径 |
22 | 22 | * |
23 | 23 | * @var array |
24 | 24 | */ |
25 | - protected $includePath=[]; |
|
25 | + protected $includePath = []; |
|
26 | 26 | |
27 | 27 | /** |
28 | 28 | * 将JAVA,路径分割转换为PHP分割符 |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | */ |
33 | 33 | public static function realName(string $name):string |
34 | 34 | { |
35 | - return str_replace(['.','/'], '\\', $name); |
|
35 | + return str_replace(['.', '/'], '\\', $name); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | /** |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | * @param string $name |
42 | 42 | * @return string|null |
43 | 43 | */ |
44 | - public static function realPath(string $name):?string |
|
44 | + public static function realPath(string $name): ?string |
|
45 | 45 | { |
46 | 46 | return Path::format($name); |
47 | 47 | } |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | * @param string $filename |
53 | 53 | * @return string|null |
54 | 54 | */ |
55 | - public function import(string $filename):?string |
|
55 | + public function import(string $filename): ?string |
|
56 | 56 | { |
57 | 57 | if ($filename = static::realPath($filename)) { |
58 | 58 | @require_once $filename; |
@@ -68,16 +68,16 @@ discard block |
||
68 | 68 | return null; |
69 | 69 | } |
70 | 70 | |
71 | - public function addIncludePath(string $path, string $namespace=null) |
|
71 | + public function addIncludePath(string $path, string $namespace = null) |
|
72 | 72 | { |
73 | 73 | if ($path = static::realPath($path)) { |
74 | 74 | $namespace = $namespace ?? 0; |
75 | 75 | if (array_key_exists($namespace, $this->includePath)) { |
76 | 76 | if (!\in_array($path, $this->includePath[$namespace])) { |
77 | - $this->includePath[$namespace][]=$path; |
|
77 | + $this->includePath[$namespace][] = $path; |
|
78 | 78 | } |
79 | 79 | } else { |
80 | - $this->includePath[$namespace][]=$path; |
|
80 | + $this->includePath[$namespace][] = $path; |
|
81 | 81 | } |
82 | 82 | } |
83 | 83 | } |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | public function setNamespace(string $namespace) |
96 | 96 | { |
97 | 97 | if (!in_array($namespace, $this->namespace)) { |
98 | - $this->namespace[]=$namespace; |
|
98 | + $this->namespace[] = $namespace; |
|
99 | 99 | } |
100 | 100 | } |
101 | 101 | } |