method scan documentation in bbn\File\Dir

Returns an array with all the content of the given directory.

function(string $dir, string $type = NULL, bool $hidden = false) { $all = []; $dir = self::clean($dir); $dirs = self::getDirs($dir); if ( \is_array($dirs) ){ if ( $type && (strpos($type, 'file') === 0) ){ $all = self::getFiles($dir, false, $hidden); } else if ( $type && ((strpos($type, 'dir') === 0) || (strpos($type, 'fold') === 0)) ){ $all = $dirs; } else if ( $type ){ $all = array_filter(self::getFiles($dir, false, $hidden), function($a)use($type){ $ext = bbn\Str::fileExt($a); return strtolower($ext) === strtolower($type); }); } else{ $files = self::getFiles($dir, false, $hidden); if ( \is_array($files) ){ $all = array_merge($dirs, $files); } } foreach ( $dirs as $d ){ $all = array_merge(\is_array($all) ? $all : [], self::scan($d, $type, $hidden)); } } return $all; }

Returns an array with all the content of the given directory. BBN is a suite of PHP and JS libraries and VueJS components - all open-source! bbn.io, build applications, the quick way

This website uses cookies to ensure you get the best experience on our website.