phpDoctor::_buildFileList PHP Method

_buildFileList() public method

Build a complete list of file to parse. Expand out wildcards and traverse directories if asked to.
public _buildFileList ( $files, $dir )
    public function _buildFileList($files, $dir)
    {
        $list = array();
        $dir = realpath($dir);
        if (!$dir) {
            return $list;
        }
        $dir = $this->fixPath($dir);
        foreach ($files as $filename) {
            $filename = $this->makeAbsolutePath(trim($filename), $dir);
            $globResults = glob($filename);
            // switch slashes since old versions of glob need forward slashes
            if ($globResults) {
                foreach ($globResults as $filepath) {
                    $okay = TRUE;
                    foreach ($this->_ignore as $ignore) {
                        if (strstr($filepath, trim($ignore))) {
                            $okay = FALSE;
                        }
                    }
                    if ($okay) {
                        $list[] = realpath($filepath);
                    }
                }
            } elseif (!$this->_subdirs) {
                $this->error('Could not find file "' . $filename . '"');
            }
        }
        if ($this->_subdirs) {
            // recurse into subdir
            $globResults = glob($dir . '*', GLOB_ONLYDIR);
            // get subdirs
            if ($globResults) {
                foreach ($globResults as $dirName) {
                    $okay = TRUE;
                    foreach ($this->_ignore as $ignore) {
                        if (strstr($dirName, trim($ignore))) {
                            $okay = FALSE;
                        }
                    }
                    if ($okay && (GLOB_ONLYDIR || is_dir($dirName))) {
                        // handle missing only dir support
                        $list = array_merge($list, $this->_buildFileList($files, $this->makeAbsolutePath($dirName, $this->_path)));
                    }
                }
            }
        }
        return $list;
    }