src/Magazine/Magazine.php
protected function rglob($pattern, $excludes = array()) {
        $files = array();
        foreach (glob($pattern, 0) as $item) {
            if (!empty($excludes) && in_array(ltrim($item, '\.\/'), $excludes)) {
                $this->trace("Skipping excluded item ./%s", ltrim($item, '\.\/'));
                continue;
            }
            if (is_dir($item)) {
                $this->debug("Globbing files in directory %s", $item);
                $files = array_merge($files, $this->rglob($item.'/*', $excludes));
            } else {
                array_push($files, ltrim($item, '\.\/'));
            }
        }
        return $files;
    }
protected function rglob($pattern, $excludes = array()) {
        $files = array();
        foreach (glob($pattern, 0) as $item) {
            if (!empty($excludes) && in_array(ltrim($item, '\.\/'), $excludes)) {
                $this->trace("Skipping excluded item ./%s", ltrim($item, '\.\/'));
                continue;
            }
            if (is_dir($item)) {
                $this->debug("Globbing files in directory %s", $item);
                $files = array_merge($files, $this->rglob($item.'/*', $excludes));
            } else {
                array_push($files, ltrim($item, '\.\/'));
            }
        }
        return $files;
    }
protected function rglob ( $ pattern , $ excludes = array ( ) ) { $ files = array ( ) ; foreach ( glob ( $ pattern , 0 ) as $ item ) { if ( ! empty ( $ excludes ) && in_array ( ltrim ( $ item , '\.\/' ) , $ excludes ) ) { $ this -> trace ( "Skipping excluded item ./%s" , ltrim ( $ item , '\.\/' ) ) ; continue ; } if ( is_dir ( $ item ) ) { $ this -> debug ( "Globbing files in directory %s" , $ item ) ; $ files = array_merge ( $ files , $ this -> rglob ( $ item . '/*' , $ excludes ) ) ; } else { array_push ( $ files , ltrim ( $ item , '\.\/' ) ) ; } } return $ files ; }
Recursively globs all the files and directories using the given pattern.
If any file or directory exists in the list of excluded items, it is
skipped

@param $pattern string the glob pattern for selecting files and directories
@param array $excludes the array of files and directories to exclude
@return array the array of files and directories matching the glob pattern
Recursively globs all the files and directories using the given pattern . If any file or directory exists in the list of excluded items it is skipped