src/Dir/Dir.php
protected static function _scan($path, $options, $dirFlags, $iteratorFlags)
    {
        if (!file_exists($path)) {
            throw new Exception("Unexisting path `{$path}`.");
        }
        if (!is_dir($path)) {
            return [$path];
        }
        $worker = new RecursiveDirectoryIterator($path, $dirFlags);
        if ($options['recursive']) {
            $worker = new RecursiveIteratorIterator($worker, $iteratorFlags);
        }
        $filter = new static($worker);
        $filter->filter($options);

        $result = [];
        foreach ($filter as $key => $value) {
            $result[] = $key;
        }
        return $result;
    }
protected static function _scan($path, $options, $dirFlags, $iteratorFlags)
    {
        if (!file_exists($path)) {
            throw new Exception("Unexisting path `{$path}`.");
        }
        if (!is_dir($path)) {
            return [$path];
        }
        $worker = new RecursiveDirectoryIterator($path, $dirFlags);
        if ($options['recursive']) {
            $worker = new RecursiveIteratorIterator($worker, $iteratorFlags);
        }
        $filter = new static($worker);
        $filter->filter($options);

        $result = [];
        foreach ($filter as $key => $value) {
            $result[] = $key;
        }
        return $result;
    }
protected static function _scan ( $ path , $ options , $ dirFlags , $ iteratorFlags ) { if ( ! file_exists ( $ path ) ) { throw new Exception ( "Unexisting path `{$path}`." ) ; } if ( ! is_dir ( $ path ) ) { return [ $ path ] ; } $ worker = new RecursiveDirectoryIterator ( $ path , $ dirFlags ) ; if ( $ options [ 'recursive' ] ) { $ worker = new RecursiveIteratorIterator ( $ worker , $ iteratorFlags ) ; } $ filter = new static ( $ worker ) ; $ filter -> filter ( $ options ) ; $ result = [ ] ; foreach ( $ filter as $ key => $ value ) { $ result [ ] = $ key ; } return $ result ; }
Scans a given directory for files.

@param  string    $path    Path or paths to scan.
@param  array     $options Scanning options. Possible values are:
-`'iterator'`       _integer_     : The iterator mode.
-`'skipDots'`       _boolean_     : Keeps '.' and '..' if `true`.
-`'leavesOnly'`     _boolean_     : Keeps only leaves if `true`.
-`'followSymlinks'` _boolean_     : Follows Symlinks if `true`.
-`'recursive'`      _boolean_     : Scans recursively if `true`.
-`'include'`        _string|array_: An array of includes.
-`'exclude'`        _string|array_: An array of excludes.
-`'type'`           _string|array_: An array of types.
@return array
Scans a given directory for files .