private function getDirContent($ext = 'php', $recurse = true, $_fileObj = false)
    {
        $_fileList = [];

        // check if some put the extension beginning with the "."
        $ext = $this->stableExt($ext);

        $directory = $this->stableDir($this->path);
        if (!file_exists($directory)) {
            return [];
        }

        $dirIterator = new \DirectoryIterator($directory);

        foreach ($dirIterator as $file) {
            if ($file->isDot()) {
                continue;
            }

            if ($file->isDir() && $recurse) {
                $_fileList = array_merge($_fileList, (new static($file->getRealPath()))->readDir($ext, $recurse));
            } else {
                $_fileList = $this->addFile($_fileList, $file, $ext, $_fileObj);
            }
        }

        return $_fileList;
    }
private function getDirContent($ext = 'php', $recurse = true, $_fileObj = false)
    {
        $_fileList = [];

        // check if some put the extension beginning with the "."
        $ext = $this->stableExt($ext);

        $directory = $this->stableDir($this->path);
        if (!file_exists($directory)) {
            return [];
        }

        $dirIterator = new \DirectoryIterator($directory);

        foreach ($dirIterator as $file) {
            if ($file->isDot()) {
                continue;
            }

            if ($file->isDir() && $recurse) {
                $_fileList = array_merge($_fileList, (new static($file->getRealPath()))->readDir($ext, $recurse));
            } else {
                $_fileList = $this->addFile($_fileList, $file, $ext, $_fileObj);
            }
        }

        return $_fileList;
    }
private function getDirContent ( $ ext = 'php' , $ recurse = true , $ _fileObj = false ) { $ _fileList = [ ] ; // check if some put the extension beginning with the "." $ ext = $ this -> stableExt ( $ ext ) ; $ directory = $ this -> stableDir ( $ this -> path ) ; if ( ! file_exists ( $ directory ) ) { return [ ] ; } $ dirIterator = new \ DirectoryIterator ( $ directory ) ; foreach ( $ dirIterator as $ file ) { if ( $ file -> isDot ( ) ) { continue ; } if ( $ file -> isDir ( ) && $ recurse ) { $ _fileList = array_merge ( $ _fileList , ( new static ( $ file -> getRealPath ( ) ) ) -> readDir ( $ ext , $ recurse ) ) ; } else { $ _fileList = $ this -> addFile ( $ _fileList , $ file , $ ext , $ _fileObj ) ; } } return $ _fileList ; }
Read contents inside a directory.

@param string     $ext
@param bool|true  $recurse
@param bool|false $_fileObj if true returns a file object, if false returns a file pathname

@return array

@since  1.1.0

@author Eddilbert Macharia (http://eddmash.com) <edd.cowan@gmail.com>
Read contents inside a directory .