@@ -333,22 +333,35 @@ protected static function _setPerms($filename, $isFlag, $perm)
333333 // Set only the user writable bit (file is owned by us)
334334 if ($ isMyUid ) {
335335 $ add = intval ('0 ' . $ perm . $ perm . $ perm , 8 );
336- return chmod ($ filename , ( fileperms ( $ filename ) | intval ( ' 0 ' . $ perm . $ perm . $ perm , 8 )) ^ $ add );
336+ return self :: _chmod ($ filename , $ perm, $ add );
337337 }
338338
339339 // Set only the group writable bit (file group is the same as us)
340340 if ($ isMyGid ) {
341341 $ add = intval ('00 ' . $ perm . $ perm , 8 );
342- return chmod ($ filename , ( fileperms ( $ filename ) | intval ( ' 0 ' . $ perm . $ perm . $ perm , 8 )) ^ $ add );
342+ return self :: _chmod ($ filename , $ perm, $ add );
343343 }
344344
345345 // Set the world writable bit (file isn't owned or grouped by us)
346346 $ add = intval ('000 ' . $ perm , 8 );
347- return chmod ($ filename , ( fileperms ( $ filename ) | intval ( ' 0 ' . $ perm . $ perm . $ perm , 8 )) ^ $ add );
347+ return self :: _chmod ($ filename , $ perm, $ add );
348348 }
349349 //@codeCoverageIgnoreEnd
350350 }
351351
352+ /**
353+ * Chmod alias
354+ *
355+ * @param string $filename
356+ * @param int $perm
357+ * @param int $add
358+ * @return bool
359+ */
360+ protected static function _chmod ($ filename , $ perm , $ add )
361+ {
362+ return chmod ($ filename , (fileperms ($ filename ) | intval ('0 ' . $ perm . $ perm . $ perm , 8 )) ^ $ add );
363+ }
364+
352365 /**
353366 * @param string $path
354367 * @return string
0 commit comments