Refactored getFiles and getDirectories return File or Directory instead of SplFileInfo