src/FileSystem/DirHandler.php
private function _list(string $path): array {
        $result = [];
        $scan = glob($path . '/*');
        foreach ($scan as $item) {
            if (is_dir($item)) {
                $result[basename($item)] = $this->_list($item);
            } else {
                $result[] = basename($item);
            }
        }
        return $result;
    }
private function _list(string $path): array {
        $result = [];
        $scan = glob($path . '/*');
        foreach ($scan as $item) {
            if (is_dir($item)) {
                $result[basename($item)] = $this->_list($item);
            } else {
                $result[] = basename($item);
            }
        }
        return $result;
    }
private function _list ( string $ path ) : array { $ result = [ ] ; $ scan = glob ( $ path . '/*' ) ; foreach ( $ scan as $ item ) { if ( is_dir ( $ item ) ) { $ result [ basename ( $ item ) ] = $ this -> _list ( $ item ) ; } else { $ result [ ] = basename ( $ item ) ; } } return $ result ; }
lists every item in a given dir

see here: https://stackoverflow.com/a/49066335/1966490

@param string $path
@return array
lists every item in a given dir