/** * @return AdtTraverser */ protected function createAdtTraverser() { $nameResolver = new NameResolver(); $nameResolver->setLogger($this->getLogger()); $traverser = new AdtTraverser(); $traverser->bindNameResolver($nameResolver); $traverser->bindAdtCollector(new AdtCollector()); return $traverser; }
public function analyze(SplFileInfo $file) { $analysis = new Analysis($file); try { if ($stmts = $this->parser->parse($file->getContents())) { $this->adtTraverser->bindFile($file); $adtStmts = $this->adtTraverser->getAdtStmtsBy($stmts); foreach ($adtStmts as $node) { $this->nodeTraverser->setAdt($analysis->createAdt()); $this->nodeTraverser->traverse(array($node)); } } } catch (Error $error) { $this->logger->error($error->getMessage(), array($file)); } $this->getAnalysisCollection()->attach($analysis); return $analysis; }