Example #1
0
 /**
  * Report running an analyzer
  * @param string                  $fileName The filename on which the analyzer is running
  * @param \SCQAT\AnalyzerAbstract $analyzer The analyzer instance
  */
 public function analyzerRun($fileName, \SCQAT\AnalyzerAbstract $analyzer)
 {
     $fileName = (string) $fileName;
     $languageName = $analyzer->getLanguageName();
     $analyzerName = $analyzer->getName();
     // Is it the first time this language is used ?
     if (!array_key_exists($languageName, $this->analyzersNames)) {
         if ($this->lastLanguageUsed) {
             if (count($this->analyzersNames[$this->lastLanguageUsed]) == 1) {
                 $this->runHook("analyzerEndOfUse", $this->lastAnalyzerUsedForLanguage);
             }
             $this->runHook("languageEndOfUse", $this->lastLanguageUsed);
         }
         $this->analyzersNames[$languageName] = array();
         $this->runHook("languageFirstUse", $languageName);
         $this->lastLanguageUsed = $languageName;
         $this->lastAnalyzerUsedForLanguage = null;
     }
     // Is it the first time this analyzer is used ?
     if (!in_array($analyzerName, $this->analyzersNames[$languageName])) {
         // Were an analyzer run before for this language ? If yes, it has finished analyzing files.
         if ($this->lastAnalyzerUsedForLanguage) {
             $this->runHook("analyzerEndOfUse", $this->lastAnalyzerUsedForLanguage);
         }
         $this->analyzersNames[$languageName][] = $analyzerName;
         $this->runHook("analyzerFirstUse", $analyzer);
         $this->lastAnalyzerUsedForLanguage = $analyzer;
     }
     $this->runHook("analyzingFile", $fileName);
 }
Example #2
0
 /**
  * {@inheritdoc}
  */
 public function analyzerFirstUse(\SCQAT\AnalyzerAbstract $analyzer)
 {
     $this->analyzerErrors = array();
     $this->output->writeln("");
     $message = "<info>[" . $analyzer->getLanguageName() . " > " . $analyzer->getName() . "] " . $analyzer::$introductionMessage . "...</info>";
     if (!empty($analyzer->needAllFiles) && $analyzer->needAllFiles === true) {
         $this->output->write($message . " ");
     } else {
         if ($this->inVerboseMode) {
             $this->output->writeln($message);
         } else {
             $this->runningProgress = new \Symfony\Component\Console\Helper\ProgressBar($this->output, $this->languageFilesCount);
             $this->runningProgress->setMessage($message);
             $this->runningProgress->setMessage("", "result");
             $this->runningProgress->start();
             $this->runningProgress->setFormat("%message% %current%/%max% %result%");
         }
     }
 }