private function processDir($dir)
{
if (!file_exists($dir)) {
return array('files' => -1, 'tokens' => -1);
}
$files = array();
$ignoredFiles = array();
if (substr($dir, -1) === '/') {
$dir = substr($dir, 0, -1);
}
Files::findFiles($dir, $files, $ignoredFiles);
$this->atoms = array($this->id0 => $this->atoms[$this->id0]);
$this->links = array();
$nbTokens = 0;
foreach ($files as $file) {
if ($r = $this->processFile($dir . $file)) {
$nbTokens += $r;
$this->saveFiles();
}
}
$this->saveDefinitions();
return array('files' => count($files), 'tokens' => $nbTokens);
}