method getTree documentation in bbn\File\System
function(string $dir, string $exclude = '', $only_dir = false, $filter = NULL, $hidden = false)
{
$r = [];
$dirs = self::getDirs($dir, $hidden);
if (\is_array($dirs)) {
foreach ($dirs as $d) {
if (X::basename($d) !== $exclude) {
$x = [
'name' => $d,
'type' => 'dir',
'num' => 0,
'items' => self::getTree($d, $exclude, $only_dir, $filter, $hidden)
];
$x['num'] = \count($x['items']);
if (empty($x['items'])) {
unset($x['items']);
}
}
if (!empty($x['items']) || $this->_check_filter($x, $filter)) {
$r[] = $x;
}
}
if (!$only_dir) {
$files = self::getFiles($dir, false, $hidden);
foreach ($files as $f) {
$x = [
'name' => $f,
'type' => 'file',
'ext' => bbn\Str::fileExt($f)
];
if ($this->_check_filter($x, $filter)) {
$r[] = $x;
}
}
}
}
return $r;
}
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.
© 2011-2025
BBN Solutions