public function readDirectory($path) { $filter = $this->filter; $modtime = filemtime($path); $cached = Cache::get('dir://' . $path, $has, $this->localCache); if ($has && $cached['modtime'] >= $modtime) { if ($this->cacheTs < $modtime) { $this->cacheTs = $modtime; } foreach ($cached['cache'] as $file => $cache) { $this->files[] = $file; $this->addFile(File::fromCache($file, $cache, $this->localCache)); } return; } $this->cached = false; $iter = new RecursiveDirectoryIterator($path, \FilesystemIterator::SKIP_DOTS); $cache = array(); foreach (new RecursiveIteratorIterator($iter) as $file) { if (!$file->isfile() || $filter && !$filter($file)) { continue; } $rpath = realpath($file->getPathname()); $this->files[] = $rpath; $file = $this->addFile(new File($file->getPathname(), $this->localCache)); $cache[$rpath] = $file->ToCache(); } Cache::set('dir://' . $path, compact('modtime', 'cache'), $this->localCache); return $this->annotations; }
protected function doParse($path) { $modtime = filemtime($path); $cached = Cache::get('file://' . $path, $found, $this->localCache); if ($found && $cached['modtime'] >= $modtime) { $this->cached = true; foreach (unserialize($cached['cache']) as $object) { $this->addObject($object); } return; } $this->cached = false; try { $parser = new ClassInfo($path); } catch (\Exception $e) { // Internal error, probably parsing buggy/invalid php code return; } foreach ($parser->getPHPDocs() as $object) { $this->addObject($object); } $cache = $this->toCache(); $cached = Cache::set('file://' . $path, compact('modtime', 'cache'), $this->localCache); return; }