@@ -31,8 +31,8 @@ public static function isAbsPath(string $path): bool
3131 }
3232
3333 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
3636 ) {
3737 return true ;
3838 }
@@ -63,9 +63,9 @@ public static function isAbsolutePath(string $file): bool
6363 */
6464 public static function pathFormat (string $ dirName ): string
6565 {
66- $ dirName = str_ireplace ('\\' , '/ ' , trim ($ dirName ));
66+ $ dirName = ( string ) \ str_ireplace ('\\' , '/ ' , trim ($ dirName ));
6767
68- return substr (( string ) $ dirName , -1 ) === '/ ' ? $ dirName : $ dirName . '/ ' ;
68+ return \ substr ($ dirName , -1 ) === '/ ' ? $ dirName : $ dirName . '/ ' ;
6969 }
7070
7171 /**
@@ -239,10 +239,8 @@ public static function chown($files, string $user, $recursive = false)
239239 if (true !== lchown ($ file , $ user )) {
240240 throw new IOException (sprintf ('Failed to chown file "%s". ' , $ file ));
241241 }
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 ));
246244 }
247245 }
248246 }
@@ -255,7 +253,7 @@ public static function chown($files, string $user, $recursive = false)
255253 */
256254 public static function getIterator (string $ srcDir , callable $ filter ): \RecursiveIteratorIterator
257255 {
258- if (!$ srcDir || !file_exists ($ srcDir )) {
256+ if (!$ srcDir || !\ file_exists ($ srcDir )) {
259257 throw new \InvalidArgumentException ('Please provide a exists source directory. ' );
260258 }
261259
0 commit comments