Exemplo n.º 1
0
 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;
 }