FileSystem/LocalFileSystem.php
public function getDirectoryTreeList()
    {
        $finder = new Finder();
        $finder->in($this->rootPath)->directories();

        $directories = array();


        $rootFinder = new Finder();
        $rootFinder->in($this->rootPath)->depth(0);

        //Add root directory
        $directories[] = new Directory($this->virtualRootPath, $rootFinder->directories()->count(), $rootFinder->files()->count());

        foreach($finder as $dir){
            $dirFinder = new Finder();
            $dirFinder->in($dir->getPathname())->depth(0);

            $virtualAbsolutePath = substr($this->fs->makePathRelative($dir->getPathname(), $this->rootPath), 0, -1); //substring to remove last /

            $directories[] = new Directory($this->virtualRootPath .'/' . $virtualAbsolutePath, $dirFinder->files()->count(), $dirFinder->directories()->count());
        }

        return $directories;
    }
public function getDirectoryTreeList()
    {
        $finder = new Finder();
        $finder->in($this->rootPath)->directories();

        $directories = array();


        $rootFinder = new Finder();
        $rootFinder->in($this->rootPath)->depth(0);

        //Add root directory
        $directories[] = new Directory($this->virtualRootPath, $rootFinder->directories()->count(), $rootFinder->files()->count());

        foreach($finder as $dir){
            $dirFinder = new Finder();
            $dirFinder->in($dir->getPathname())->depth(0);

            $virtualAbsolutePath = substr($this->fs->makePathRelative($dir->getPathname(), $this->rootPath), 0, -1); //substring to remove last /

            $directories[] = new Directory($this->virtualRootPath .'/' . $virtualAbsolutePath, $dirFinder->files()->count(), $dirFinder->directories()->count());
        }

        return $directories;
    }
public function getDirectoryTreeList ( ) { $ finder = new Finder ( ) ; $ finder -> in ( $ this -> rootPath ) -> directories ( ) ; $ directories = array ( ) ; $ rootFinder = new Finder ( ) ; $ rootFinder -> in ( $ this -> rootPath ) -> depth ( 0 ) ; //Add root directory $ directories [ ] = new Directory ( $ this -> virtualRootPath , $ rootFinder -> directories ( ) -> count ( ) , $ rootFinder -> files ( ) -> count ( ) ) ; foreach ( $ finder as $ dir ) { $ dirFinder = new Finder ( ) ; $ dirFinder -> in ( $ dir -> getPathname ( ) ) -> depth ( 0 ) ; $ virtualAbsolutePath = substr ( $ this -> fs -> makePathRelative ( $ dir -> getPathname ( ) , $ this -> rootPath ) , 0 , - 1 ) ; //substring to remove last / $ directories [ ] = new Directory ( $ this -> virtualRootPath . '/' . $ virtualAbsolutePath , $ dirFinder -> files ( ) -> count ( ) , $ dirFinder -> directories ( ) -> count ( ) ) ; } return $ directories ; }
Return the directory tree in the form of a list
@return DirectoryInterface[]
Return the directory tree in the form of a list