public function scanDir($recursive = false)
    {
        if (!$this->exists()) return false;
        $_dir = opendir($this->getPath().$this->dirname);
        $data = array();
        while ($entry = @readdir($_dir)) {
            if (!in_array($entry, $this->ignore)) {
                if (is_dir($this->getPath().$this->dirname.'/'.$entry)) {
                    if (true === $recursive){
                        $_new_dir = new DirectoryModel;
                        $_new_dir->setPath( $this->getPath().$this->dirname );
                        $_new_dir->setDirname( $entry );
                        $data[] = $_new_dir->scanDir( $recursive );
                    } else {
                        $data[] = $entry;
                    }
                } else {
                    $data[] = $entry;
                }
            }
        }
        closedir($_dir);
        return $data;
    }
public function scanDir($recursive = false)
    {
        if (!$this->exists()) return false;
        $_dir = opendir($this->getPath().$this->dirname);
        $data = array();
        while ($entry = @readdir($_dir)) {
            if (!in_array($entry, $this->ignore)) {
                if (is_dir($this->getPath().$this->dirname.'/'.$entry)) {
                    if (true === $recursive){
                        $_new_dir = new DirectoryModel;
                        $_new_dir->setPath( $this->getPath().$this->dirname );
                        $_new_dir->setDirname( $entry );
                        $data[] = $_new_dir->scanDir( $recursive );
                    } else {
                        $data[] = $entry;
                    }
                } else {
                    $data[] = $entry;
                }
            }
        }
        closedir($_dir);
        return $data;
    }
public function scanDir ( $ recursive = false ) { if ( ! $ this -> exists ( ) ) return false ; $ _dir = opendir ( $ this -> getPath ( ) . $ this -> dirname ) ; $ data = array ( ) ; while ( $ entry = @ readdir ( $ _dir ) ) { if ( ! in_array ( $ entry , $ this -> ignore ) ) { if ( is_dir ( $ this -> getPath ( ) . $ this -> dirname . '/' . $ entry ) ) { if ( true === $ recursive ) { $ _new_dir = new DirectoryModel ; $ _new_dir -> setPath ( $ this -> getPath ( ) . $ this -> dirname ) ; $ _new_dir -> setDirname ( $ entry ) ; $ data [ ] = $ _new_dir -> scanDir ( $ recursive ) ; } else { $ data [ ] = $ entry ; } } else { $ data [ ] = $ entry ; } } } closedir ( $ _dir ) ; return $ data ; }
Scan the current directory

@param bool $recursive Is the scan recursive ?
@return array
Scan the current directory