From 0665f952fdee73f0fe41c0b311ea82ac6718bcb3 Mon Sep 17 00:00:00 2001 From: Andrew Huggins Date: Wed, 19 Apr 2017 16:34:41 -0400 Subject: [PATCH] change Filesystem files() to return similar structured arrays as allFiles() --- src/Illuminate/Filesystem/Filesystem.php | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/src/Illuminate/Filesystem/Filesystem.php b/src/Illuminate/Filesystem/Filesystem.php index 6dbf335376e3..e2a2135db799 100644 --- a/src/Illuminate/Filesystem/Filesystem.php +++ b/src/Illuminate/Filesystem/Filesystem.php @@ -372,20 +372,9 @@ public function glob($pattern, $flags = 0) * @param string $directory * @return array */ - public function files($directory) + public function files($directory, $hidden = false) { - $glob = glob($directory.'/*'); - - if ($glob === false) { - return []; - } - - // To get the appropriate files, we'll simply glob the directory and filter - // out any "files" that are not truly files so we do not end up with any - // directories in our list, but only true files within the directory. - return array_filter($glob, function ($file) { - return filetype($file) == 'file'; - }); + return iterator_to_array(Finder::create()->files()->ignoreDotFiles(! $hidden)->in($directory)->depth(0), false); } /**