@@ -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; |
@@ -86,9 +86,9 @@ discard block |
||
86 | 86 | * @param string $name |
87 | 87 | * @return string|null |
88 | 88 | */ |
89 | - public static function get(string $filename):?string |
|
89 | + public static 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; |
@@ -94,11 +94,11 @@ discard block |
||
94 | 94 | * @param boolean $full |
95 | 95 | * @return \Iterator |
96 | 96 | */ |
97 | - public static function readFiles(string $path, bool $recursive=false, ?string $regex=null, bool $full=true, int $mode = RecursiveIteratorIterator::LEAVES_ONLY) : \Iterator |
|
97 | + public static function readFiles(string $path, bool $recursive = false, ?string $regex = null, bool $full = true, int $mode = RecursiveIteratorIterator::LEAVES_ONLY) : \Iterator |
|
98 | 98 | { |
99 | 99 | $parent = Path::format($path); |
100 | 100 | foreach (static::read($path, $recursive, $regex, false, $mode) as $subpath) { |
101 | - $path = $full?$subpath:$parent.DIRECTORY_SEPARATOR.$subpath; |
|
101 | + $path = $full ? $subpath : $parent.DIRECTORY_SEPARATOR.$subpath; |
|
102 | 102 | if (is_file($path)) { |
103 | 103 | yield $subpath; |
104 | 104 | } |
@@ -114,11 +114,11 @@ discard block |
||
114 | 114 | * @param boolean $full |
115 | 115 | * @return \Iterator |
116 | 116 | */ |
117 | - public static function readDirs(string $path, bool $recursive=false, ?string $regex=null, bool $full=false, int $mode = RecursiveIteratorIterator::LEAVES_ONLY): \Iterator |
|
117 | + public static function readDirs(string $path, bool $recursive = false, ?string $regex = null, bool $full = false, int $mode = RecursiveIteratorIterator::LEAVES_ONLY): \Iterator |
|
118 | 118 | { |
119 | 119 | $parent = Path::format($path); |
120 | 120 | foreach (static::read($path, $recursive, $regex, false, $mode) as $subpath) { |
121 | - $path = $full?$subpath:$parent.DIRECTORY_SEPARATOR.$subpath; |
|
121 | + $path = $full ? $subpath : $parent.DIRECTORY_SEPARATOR.$subpath; |
|
122 | 122 | if (is_dir($path)) { |
123 | 123 | yield $subpath; |
124 | 124 | } |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | * @param boolean $full |
135 | 135 | * @return \Iterator |
136 | 136 | */ |
137 | - public static function read(string $path, bool $recursive=false, ?string $regex=null, bool $full=true, int $mode = RecursiveIteratorIterator::LEAVES_ONLY): \Iterator |
|
137 | + public static function read(string $path, bool $recursive = false, ?string $regex = null, bool $full = true, int $mode = RecursiveIteratorIterator::LEAVES_ONLY): \Iterator |
|
138 | 138 | { |
139 | 139 | $directory = Path::format($path); |
140 | 140 | if ($directory && \is_dir($directory)) { |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | */ |
165 | 165 | public static function cut(string $path, string $basepath):string |
166 | 166 | { |
167 | - $path = PathTrait::toAbsolutePath($path); |
|
167 | + $path = PathTrait::toAbsolutePath($path); |
|
168 | 168 | $basepath = PathTrait::toAbsolutePath($basepath); |
169 | 169 | if (strpos($path, $basepath.DIRECTORY_SEPARATOR) === 0) { |
170 | 170 | return substr($path, \strlen($basepath) + 1); |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | * @param boolean $move |
182 | 182 | * @return boolean |
183 | 183 | */ |
184 | - public static function copy(string $path, string $toPath, ?string $regex=null, bool $move = false):bool |
|
184 | + public static function copy(string $path, string $toPath, ?string $regex = null, bool $move = false):bool |
|
185 | 185 | { |
186 | 186 | $directory = Path::format($path); |
187 | 187 | static::makes($toPath); |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | * @param string|null $regex |
217 | 217 | * @return boolean |
218 | 218 | */ |
219 | - public static function move(string $path, string $toPath, ?string $regex=null):bool |
|
219 | + public static function move(string $path, string $toPath, ?string $regex = null):bool |
|
220 | 220 | { |
221 | 221 | return static::copy($path, $toPath, $regex, true); |
222 | 222 | } |