Could be moved into the filesystem class that was just added: https://github.com/phpbb/phpbb3/blob/develop/phpBB/includes/filesystem.php

If another class uses the function, you just set filesystem as dependency