public function scan($file)
{
// If no decision is already made about this file
if (!isset($this->states[$file])) {
$this->display(' -> Scanning ' . $file . '...');
$this->states[$file] = self::NO_PARSE;
$entry = $this->metas->get($file);
$rst = $this->getRST($file);
if (!$entry || !file_exists($rst) || $entry['ctime'] < filectime($rst)) {
// File was never seen or changed and thus need to be parsed
$this->addToParseQueue($file);
} else {
// Have a look to the file dependencies to knoww if you need to parse
// it or not
$depends = $entry['depends'];
if (isset($entry['parent'])) {
$depends[] = $entry['parent'];
}
foreach ($depends as $dependency) {
$this->scan($dependency);
// If any dependency needs to be parsed, this file needs also to be
// parsed
if ($this->states[$dependency] == self::PARSE) {
$this->addToParseQueue($file);
}
}
}
}
}