Example #1
0
 /**
  * Print one character representing a checked file. Defaults to dot.
  * When a multiple of 60 files has been analyzed, the number of
  * files that have already been analyzed and the total number of files
  * to analyze plus a line break will be output.
  *
  * @param string $file File that was checked
  * @param Result $result Result object
  * @return void
  */
 public function showProgress($file, Result $result, Application $application)
 {
     // we just fetch the number of files from the application once,
     // since it is not going to change during the run.
     // Note: if number of files is zero, an exception is thrown in run(),
     if ($this->numberOfFiles == 0) {
         $this->numberOfFiles = $application->getNumberOfFiles();
     }
     $this->fileCount++;
     $this->positionCount++;
     $letter = $this->getProgressLetter($file, $result);
     if ($this->verbose) {
         switch ($letter) {
             case '.':
                 $letter = 'OK';
                 break;
             case 'F':
                 $letter = 'FAIL';
                 break;
             case 'E':
                 $letter = 'ERROR';
                 break;
         }
         print $this->formatFileCount($this->fileCount) . ' ' . $file . ': ' . $letter . PHP_EOL;
     } else {
         print $letter;
         if ($this->positionCount > 59) {
             print ' ' . $this->formatFileCount($this->fileCount) . ' / ' . $this->numberOfFiles . PHP_EOL;
             $this->positionCount = 0;
         }
     }
 }