@@ -31,8 +31,8 @@ public static function isAbsPath(string $path): bool
31
31
}
32
32
33
33
if (
34
- $ path{ 0 } === ' / ' || // linux/mac
35
- 1 === preg_match ('#^[a-z]:[\/| \\\]{1}.+#i ' , $ path ) // windows
34
+ \strpos ( $ path, ' / ' ) === 0 || // linux/mac
35
+ 1 === \ preg_match ('#^[a-z]:[\/| \\\]{1}.+#i ' , $ path ) // windows
36
36
) {
37
37
return true ;
38
38
}
@@ -63,9 +63,9 @@ public static function isAbsolutePath(string $file): bool
63
63
*/
64
64
public static function pathFormat (string $ dirName ): string
65
65
{
66
- $ dirName = str_ireplace ('\\' , '/ ' , trim ($ dirName ));
66
+ $ dirName = ( string ) \ str_ireplace ('\\' , '/ ' , trim ($ dirName ));
67
67
68
- return substr (( string ) $ dirName , -1 ) === '/ ' ? $ dirName : $ dirName . '/ ' ;
68
+ return \ substr ($ dirName , -1 ) === '/ ' ? $ dirName : $ dirName . '/ ' ;
69
69
}
70
70
71
71
/**
@@ -239,10 +239,8 @@ public static function chown($files, string $user, $recursive = false)
239
239
if (true !== lchown ($ file , $ user )) {
240
240
throw new IOException (sprintf ('Failed to chown file "%s". ' , $ file ));
241
241
}
242
- } else {
243
- if (true !== chown ($ file , $ user )) {
244
- throw new IOException (sprintf ('Failed to chown file "%s". ' , $ file ));
245
- }
242
+ } elseif (true !== chown ($ file , $ user )) {
243
+ throw new IOException (sprintf ('Failed to chown file "%s". ' , $ file ));
246
244
}
247
245
}
248
246
}
@@ -255,7 +253,7 @@ public static function chown($files, string $user, $recursive = false)
255
253
*/
256
254
public static function getIterator (string $ srcDir , callable $ filter ): \RecursiveIteratorIterator
257
255
{
258
- if (!$ srcDir || !file_exists ($ srcDir )) {
256
+ if (!$ srcDir || !\ file_exists ($ srcDir )) {
259
257
throw new \InvalidArgumentException ('Please provide a exists source directory. ' );
260
258
}
261
259
0 commit comments