当前位置: 首页>>代码示例>>PHP>>正文


PHP PHP_CodeSniffer_Reporting::printRunTime方法代码示例

本文整理汇总了PHP中PHP_CodeSniffer_Reporting::printRunTime方法的典型用法代码示例。如果您正苦于以下问题:PHP PHP_CodeSniffer_Reporting::printRunTime方法的具体用法?PHP PHP_CodeSniffer_Reporting::printRunTime怎么用?PHP PHP_CodeSniffer_Reporting::printRunTime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PHP_CodeSniffer_Reporting的用法示例。


在下文中一共展示了PHP_CodeSniffer_Reporting::printRunTime方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: generate

 /**
  * Prints all errors and warnings for each file processed.
  *
  * @param string  $cachedData    Any partial report data that was returned from
  *                               generateFileReport during the run.
  * @param int     $totalFiles    Total number of files processed during the run.
  * @param int     $totalErrors   Total number of errors found during the run.
  * @param int     $totalWarnings Total number of warnings found during the run.
  * @param int     $totalFixable  Total number of problems that can be fixed.
  * @param boolean $showSources   Show sources?
  * @param int     $width         Maximum allowed line width.
  * @param boolean $toScreen      Is the report being printed to screen?
  *
  * @return void
  */
 public function generate($cachedData, $totalFiles, $totalErrors, $totalWarnings, $totalFixable, $showSources = false, $width = 80, $toScreen = true)
 {
     if ($cachedData === '') {
         return;
     }
     echo $cachedData;
     if ($toScreen === true && PHP_CODESNIFFER_INTERACTIVE === false) {
         PHP_CodeSniffer_Reporting::printRunTime();
     }
 }
开发者ID:Makiss,项目名称:test_guestbook_mvc,代码行数:25,代码来源:Full.php

示例2: generate

 /**
  * Prints the source of all errors and warnings.
  *
  * @param string  $cachedData    Any partial report data that was returned from
  *                               generateFileReport during the run.
  * @param int     $totalFiles    Total number of files processed during the run.
  * @param int     $totalErrors   Total number of errors found during the run.
  * @param int     $totalWarnings Total number of warnings found during the run.
  * @param int     $totalFixable  Total number of problems that can be fixed.
  * @param boolean $showSources   Show sources?
  * @param int     $width         Maximum allowed line width.
  * @param boolean $toScreen      Is the report being printed to screen?
  *
  * @return void
  */
 public function generate($cachedData, $totalFiles, $totalErrors, $totalWarnings, $totalFixable, $showSources = false, $width = 80, $toScreen = true)
 {
     if (empty($this->_metricCache) === true) {
         // Nothing to show.
         return;
     }
     ksort($this->_metricCache);
     echo PHP_EOL . "[1m" . 'PHP CODE SNIFFER INFORMATION REPORT' . "[0m" . PHP_EOL;
     echo str_repeat('-', 70) . PHP_EOL;
     foreach ($this->_metricCache as $metric => $values) {
         $winner = '';
         $winnerCount = 0;
         $totalCount = 0;
         foreach ($values as $value => $count) {
             $totalCount += $count;
             if ($count > $winnerCount) {
                 $winner = $value;
                 $winnerCount = $count;
             }
         }
         $winPercent = round($winnerCount / $totalCount * 100, 2);
         echo "{$metric}: [4m{$winner}[0m [{$winnerCount}/{$totalCount}, {$winPercent}%]" . PHP_EOL;
         asort($values);
         $values = array_reverse($values, true);
         foreach ($values as $value => $count) {
             if ($value === $winner) {
                 continue;
             }
             $percent = round($count / $totalCount * 100, 2);
             echo "\t{$value} => {$count} ({$percent}%)" . PHP_EOL;
         }
         echo PHP_EOL;
     }
     //end foreach
     echo str_repeat('-', 70) . PHP_EOL;
     if ($toScreen === true && PHP_CODESNIFFER_INTERACTIVE === false) {
         PHP_CodeSniffer_Reporting::printRunTime();
     }
 }
开发者ID:kmiku7,项目名称:PHP_CodeSniffer-2.3.2-annotated,代码行数:54,代码来源:Info.php

示例3: printErrorReport

 /**
  * Prints the error report for the run.
  *
  * Note that this function may actually print multiple reports
  * as the user may have specified a number of output formats.
  *
  * @param PHP_CodeSniffer $phpcs       The PHP_CodeSniffer object containing
  *                                     the errors.
  * @param array           $reports     A list of reports to print.
  * @param bool            $showSources TRUE if report should show error sources
  *                                     (not used by all reports).
  * @param string          $reportFile  A default file to log report output to.
  * @param int             $reportWidth How wide the screen reports should be.
  *
  * @return int The number of error and warning messages shown.
  */
 public function printErrorReport(PHP_CodeSniffer $phpcs, $reports, $showSources, $reportFile, $reportWidth)
 {
     if (empty($reports) === true) {
         $reports['full'] = $reportFile;
     }
     $errors = 0;
     $warnings = 0;
     $toScreen = false;
     foreach ($reports as $report => $output) {
         if ($output === null) {
             $output = $reportFile;
         }
         if ($reportFile === null) {
             $toScreen = true;
         }
         // We don't add errors here because the number of
         // errors reported by each report type will always be the
         // same, so we really just need 1 number.
         $result = $phpcs->reporting->printReport($report, $showSources, $this->values, $output, $reportWidth);
         $errors = $result['errors'];
         $warnings = $result['warnings'];
     }
     //end foreach
     // Only print timer output if no reports were
     // printed to the screen so we don't put additional output
     // in something like an XML report. If we are printing to screen,
     // the report types would have already worked out who should
     // print the timer info.
     if (PHP_CODESNIFFER_INTERACTIVE === false && ($toScreen === false || $errors + $warnings === 0 && $this->values['showProgress'] === true)) {
         PHP_CodeSniffer_Reporting::printRunTime();
     }
     // They should all return the same value, so it
     // doesn't matter which return value we end up using.
     $ignoreWarnings = PHP_CodeSniffer::getConfigData('ignore_warnings_on_exit');
     $ignoreErrors = PHP_CodeSniffer::getConfigData('ignore_errors_on_exit');
     $return = $errors + $warnings;
     if ($ignoreErrors !== null) {
         $ignoreErrors = (bool) $ignoreErrors;
         if ($ignoreErrors === true) {
             $return -= $errors;
         }
     }
     if ($ignoreWarnings !== null) {
         $ignoreWarnings = (bool) $ignoreWarnings;
         if ($ignoreWarnings === true) {
             $return -= $warnings;
         }
     }
     return $return;
 }
开发者ID:ghermans,项目名称:PHP_CodeSniffer,代码行数:66,代码来源:CLI.php

示例4: generate

 /**
  * Prints the author of all errors and warnings, as given by "version control blame".
  *
  * @param string  $cachedData    Any partial report data that was returned from
  *                               generateFileReport during the run.
  * @param int     $totalFiles    Total number of files processed during the run.
  * @param int     $totalErrors   Total number of errors found during the run.
  * @param int     $totalWarnings Total number of warnings found during the run.
  * @param int     $totalFixable  Total number of problems that can be fixed.
  * @param boolean $showSources   Show sources?
  * @param int     $width         Maximum allowed line width.
  * @param boolean $toScreen      Is the report being printed to screen?
  *
  * @return void
  */
 public function generate($cachedData, $totalFiles, $totalErrors, $totalWarnings, $totalFixable, $showSources = false, $width = 80, $toScreen = true)
 {
     $errorsShown = $totalErrors + $totalWarnings;
     if ($errorsShown === 0) {
         // Nothing to show.
         return;
     }
     $width = max($width, 70);
     arsort($this->_authorCache);
     echo PHP_EOL . 'PHP CODE SNIFFER ' . $this->reportName . ' BLAME SUMMARY' . PHP_EOL;
     echo str_repeat('-', $width) . PHP_EOL;
     if ($showSources === true) {
         echo 'AUTHOR   SOURCE' . str_repeat(' ', $width - 43) . '(Author %) (Overall %) COUNT' . PHP_EOL;
         echo str_repeat('-', $width) . PHP_EOL;
     } else {
         echo 'AUTHOR' . str_repeat(' ', $width - 34) . '(Author %) (Overall %) COUNT' . PHP_EOL;
         echo str_repeat('-', $width) . PHP_EOL;
     }
     foreach ($this->_authorCache as $author => $count) {
         if ($this->_praiseCache[$author]['good'] === 0) {
             $percent = 0;
         } else {
             $total = $this->_praiseCache[$author]['bad'] + $this->_praiseCache[$author]['good'];
             $percent = round($this->_praiseCache[$author]['bad'] / $total * 100, 2);
         }
         $overallPercent = '(' . round($count / $errorsShown * 100, 2) . ')';
         $authorPercent = '(' . $percent . ')';
         $line = str_repeat(' ', 6 - strlen($count)) . $count;
         $line = str_repeat(' ', 12 - strlen($overallPercent)) . $overallPercent . $line;
         $line = str_repeat(' ', 11 - strlen($authorPercent)) . $authorPercent . $line;
         $line = $author . str_repeat(' ', $width - strlen($author) - strlen($line)) . $line;
         echo $line . PHP_EOL;
         if ($showSources === true && isset($this->_sourceCache[$author]) === true) {
             $errors = $this->_sourceCache[$author];
             asort($errors);
             $errors = array_reverse($errors);
             foreach ($errors as $source => $count) {
                 if ($source === 'count') {
                     continue;
                 }
                 $line = str_repeat(' ', 5 - strlen($count)) . $count;
                 echo '         ' . $source . str_repeat(' ', $width - 14 - strlen($source)) . $line . PHP_EOL;
             }
         }
     }
     //end foreach
     echo str_repeat('-', $width) . PHP_EOL;
     echo 'A TOTAL OF ' . $errorsShown . ' SNIFF VIOLATION';
     if ($errorsShown !== 1) {
         echo 'S';
     }
     echo ' WERE COMMITTED BY ' . count($this->_authorCache) . ' AUTHOR';
     if (count($this->_authorCache) !== 1) {
         echo 'S';
     }
     if ($totalFixable > 0) {
         echo PHP_EOL . str_repeat('-', $width) . PHP_EOL;
         echo 'PHPCBF CAN FIX ' . $totalFixable . ' OF THESE SNIFF VIOLATIONS AUTOMATICALLY';
     }
     echo PHP_EOL . str_repeat('-', $width) . PHP_EOL . PHP_EOL;
     if ($toScreen === true && PHP_CODESNIFFER_INTERACTIVE === false) {
         PHP_CodeSniffer_Reporting::printRunTime();
     }
 }
开发者ID:eduardobenito10,项目名称:jenkins-php-quickstart,代码行数:79,代码来源:VersionControl.php

示例5: generate


//.........这里部分代码省略.........
         $maxLength = max($maxLength, $data['strlen']);
     }
     if ($showSources === true) {
         $width = min($width, $maxLength + 11);
     } else {
         $width = min($width, $maxLength + 41);
     }
     $width = max($width, 70);
     asort($this->_sourceCache);
     $this->_sourceCache = array_reverse($this->_sourceCache);
     echo PHP_EOL . "[1mPHP CODE SNIFFER VIOLATION SOURCE SUMMARY[0m" . PHP_EOL;
     echo str_repeat('-', $width) . PHP_EOL . "[1m";
     if ($showSources === true) {
         if ($totalFixable > 0) {
             echo '    SOURCE' . str_repeat(' ', $width - 15) . 'COUNT' . PHP_EOL;
         } else {
             echo 'SOURCE' . str_repeat(' ', $width - 11) . 'COUNT' . PHP_EOL;
         }
     } else {
         if ($totalFixable > 0) {
             echo '    STANDARD  CATEGORY            SNIFF' . str_repeat(' ', $width - 44) . 'COUNT' . PHP_EOL;
         } else {
             echo 'STANDARD  CATEGORY            SNIFF' . str_repeat(' ', $width - 40) . 'COUNT' . PHP_EOL;
         }
     }
     echo "[0m" . str_repeat('-', $width) . PHP_EOL;
     $fixableSources = 0;
     if ($showSources === true) {
         $maxSniffWidth = $width - 7;
     } else {
         $maxSniffWidth = $width - 37;
     }
     if ($totalFixable > 0) {
         $maxSniffWidth -= 4;
     }
     foreach ($this->_sourceCache as $source => $sourceData) {
         if ($totalFixable > 0) {
             echo '[';
             if ($sourceData['fixable'] === true) {
                 echo 'x';
                 $fixableSources++;
             } else {
                 echo ' ';
             }
             echo '] ';
         }
         if ($showSources === true) {
             if ($sourceData['strlen'] > $maxSniffWidth) {
                 $source = substr($source, 0, $maxSniffWidth);
             }
             echo $source;
             if ($totalFixable > 0) {
                 echo str_repeat(' ', $width - 9 - strlen($source));
             } else {
                 echo str_repeat(' ', $width - 5 - strlen($source));
             }
         } else {
             $parts = $sourceData['parts'];
             if (strlen($parts[0]) > 8) {
                 $parts[0] = substr($parts[0], 0, (strlen($parts[0]) - 8) * -1);
             }
             echo $parts[0] . str_repeat(' ', 10 - strlen($parts[0]));
             $category = $parts[1];
             if (strlen($category) > 18) {
                 $category = substr($category, 0, (strlen($category) - 18) * -1);
             }
             echo $category . str_repeat(' ', 20 - strlen($category));
             $sniff = $parts[2];
             if (strlen($sniff) > $maxSniffWidth) {
                 $sniff = substr($sniff, 0, $maxSniffWidth);
             }
             if ($totalFixable > 0) {
                 echo $sniff . str_repeat(' ', $width - 39 - strlen($sniff));
             } else {
                 echo $sniff . str_repeat(' ', $width - 35 - strlen($sniff));
             }
         }
         //end if
         echo $sourceData['count'] . PHP_EOL;
     }
     //end foreach
     echo str_repeat('-', $width) . PHP_EOL;
     echo "[1m" . 'A TOTAL OF ' . ($totalErrors + $totalWarnings) . ' SNIFF VIOLATION';
     if ($totalErrors + $totalWarnings > 1) {
         echo 'S';
     }
     echo ' WERE FOUND IN ' . count($this->_sourceCache) . ' SOURCE';
     if (count($this->_sourceCache) !== 1) {
         echo 'S';
     }
     echo "[0m";
     if ($totalFixable > 0) {
         echo PHP_EOL . str_repeat('-', $width) . PHP_EOL;
         echo "[1mPHPCBF CAN FIX THE {$fixableSources} MARKED SOURCES AUTOMATICALLY ({$totalFixable} VIOLATIONS IN TOTAL)[0m";
     }
     echo PHP_EOL . str_repeat('-', $width) . PHP_EOL . PHP_EOL;
     if ($toScreen === true && PHP_CODESNIFFER_INTERACTIVE === false) {
         PHP_CodeSniffer_Reporting::printRunTime();
     }
 }
开发者ID:lunnlew,项目名称:Norma_Code,代码行数:101,代码来源:Source.php

示例6: generate


//.........这里部分代码省略.........
 public function generate($cachedData, $totalFiles, $totalErrors, $totalWarnings, $totalFixable, $showSources = false, $width = 80, $toScreen = true)
 {
     $width = max($width, 70);
     if (empty($this->_sourceCache) === true) {
         // Nothing to show.
         return;
     }
     asort($this->_sourceCache);
     $this->_sourceCache = array_reverse($this->_sourceCache);
     echo PHP_EOL . 'PHP CODE SNIFFER VIOLATION SOURCE SUMMARY' . PHP_EOL;
     echo str_repeat('-', $width) . PHP_EOL;
     if ($showSources === true) {
         if ($totalFixable > 0) {
             echo '    SOURCE' . str_repeat(' ', $width - 15) . 'COUNT' . PHP_EOL;
         } else {
             echo 'SOURCE' . str_repeat(' ', $width - 11) . 'COUNT' . PHP_EOL;
         }
     } else {
         if ($totalFixable > 0) {
             echo '    STANDARD  CATEGORY            SNIFF' . str_repeat(' ', $width - 44) . 'COUNT' . PHP_EOL;
         } else {
             echo 'STANDARD  CATEGORY            SNIFF' . str_repeat(' ', $width - 40) . 'COUNT' . PHP_EOL;
         }
     }
     echo str_repeat('-', $width) . PHP_EOL;
     $fixableSources = 0;
     $maxSniffWidth = 37;
     if ($totalFixable > 0) {
         $maxSniffWidth += 4;
     }
     foreach ($this->_sourceCache as $source => $sourceData) {
         if ($totalFixable > 0) {
             echo '[';
             if ($sourceData['fixable'] === true) {
                 echo 'x';
                 $fixableSources++;
             } else {
                 echo ' ';
             }
             echo '] ';
         }
         if ($showSources === true) {
             echo $source;
             if ($totalFixable > 0) {
                 echo str_repeat(' ', $width - 9 - strlen($source));
             } else {
                 echo str_repeat(' ', $width - 5 - strlen($source));
             }
         } else {
             $parts = explode('.', $source);
             if ($parts[0] === 'Internal') {
                 $parts[2] = $parts[1];
                 $parts[1] = '';
             }
             if (strlen($parts[0]) > 8) {
                 $parts[0] = substr($parts[0], 0, (strlen($parts[0]) - 8) * -1);
             }
             echo $parts[0] . str_repeat(' ', 10 - strlen($parts[0]));
             $category = $this->makeFriendlyName($parts[1]);
             if (strlen($category) > 18) {
                 $category = substr($category, 0, (strlen($category) - 18) * -1);
             }
             echo $category . str_repeat(' ', 20 - strlen($category));
             $sniff = $this->makeFriendlyName($parts[2]);
             if (isset($parts[3]) === true) {
                 $name = $this->makeFriendlyName($parts[3]);
                 $name[0] = strtolower($name[0]);
                 $sniff .= ' ' . $name;
             }
             if (strlen($sniff) > $width - $maxSniffWidth) {
                 $sniff = substr($sniff, 0, $width - $maxSniffWidth - strlen($sniff));
             }
             if ($totalFixable > 0) {
                 echo $sniff . str_repeat(' ', $width - 39 - strlen($sniff));
             } else {
                 echo $sniff . str_repeat(' ', $width - 35 - strlen($sniff));
             }
         }
         //end if
         echo $sourceData['count'] . PHP_EOL;
     }
     //end foreach
     echo str_repeat('-', $width) . PHP_EOL;
     echo 'A TOTAL OF ' . ($totalErrors + $totalWarnings) . ' SNIFF VIOLATION';
     if ($totalErrors + $totalWarnings > 1) {
         echo 'S';
     }
     echo ' WERE FOUND IN ' . count($this->_sourceCache) . ' SOURCE';
     if (count($this->_sourceCache) !== 1) {
         echo 'S';
     }
     if ($totalFixable > 0) {
         echo PHP_EOL . str_repeat('-', $width) . PHP_EOL;
         echo "PHPCBF CAN FIX THE {$fixableSources} MARKED SOURCES AUTOMATICALLY ({$totalFixable} VIOLATIONS IN TOTAL)";
     }
     echo PHP_EOL . str_repeat('-', $width) . PHP_EOL . PHP_EOL;
     if ($toScreen === true && PHP_CODESNIFFER_INTERACTIVE === false) {
         PHP_CodeSniffer_Reporting::printRunTime();
     }
 }
开发者ID:eduardobenito10,项目名称:jenkins-php-quickstart,代码行数:101,代码来源:Source.php

示例7: generate


//.........这里部分代码省略.........
     }
     $width = min($width, $maxLength + 30);
     $width = max($width, 70);
     arsort($this->_authorCache);
     echo PHP_EOL . "[1m" . 'PHP CODE SNIFFER ' . $this->reportName . ' BLAME SUMMARY' . "[0m" . PHP_EOL;
     echo str_repeat('-', $width) . PHP_EOL . "[1m";
     if ($showSources === true) {
         echo 'AUTHOR   SOURCE' . str_repeat(' ', $width - 43) . '(Author %) (Overall %) COUNT' . PHP_EOL;
         echo str_repeat('-', $width) . PHP_EOL;
     } else {
         echo 'AUTHOR' . str_repeat(' ', $width - 34) . '(Author %) (Overall %) COUNT' . PHP_EOL;
         echo str_repeat('-', $width) . PHP_EOL;
     }
     echo "[0m";
     if ($showSources === true) {
         $maxSniffWidth = $width - 15;
         if ($totalFixable > 0) {
             $maxSniffWidth -= 4;
         }
     }
     $fixableSources = 0;
     foreach ($this->_authorCache as $author => $count) {
         if ($this->_praiseCache[$author]['good'] === 0) {
             $percent = 0;
         } else {
             $total = $this->_praiseCache[$author]['bad'] + $this->_praiseCache[$author]['good'];
             $percent = round($this->_praiseCache[$author]['bad'] / $total * 100, 2);
         }
         $overallPercent = '(' . round($count / $errorsShown * 100, 2) . ')';
         $authorPercent = '(' . $percent . ')';
         $line = str_repeat(' ', 6 - strlen($count)) . $count;
         $line = str_repeat(' ', 12 - strlen($overallPercent)) . $overallPercent . $line;
         $line = str_repeat(' ', 11 - strlen($authorPercent)) . $authorPercent . $line;
         $line = $author . str_repeat(' ', $width - strlen($author) - strlen($line)) . $line;
         if ($showSources === true) {
             $line = "[1m{$line}[0m";
         }
         echo $line . PHP_EOL;
         if ($showSources === true && isset($this->_sourceCache[$author]) === true) {
             $errors = $this->_sourceCache[$author];
             asort($errors);
             $errors = array_reverse($errors);
             foreach ($errors as $source => $sourceData) {
                 if ($source === 'count') {
                     continue;
                 }
                 $count = $sourceData['count'];
                 $srcLength = strlen($source);
                 if ($srcLength > $maxSniffWidth) {
                     $source = substr($source, 0, $maxSniffWidth);
                 }
                 $line = str_repeat(' ', 5 - strlen($count)) . $count;
                 echo '         ';
                 if ($totalFixable > 0) {
                     echo '[';
                     if ($sourceData['fixable'] === true) {
                         echo 'x';
                         $fixableSources++;
                     } else {
                         echo ' ';
                     }
                     echo '] ';
                 }
                 echo $source;
                 if ($totalFixable > 0) {
                     echo str_repeat(' ', $width - 18 - strlen($source));
                 } else {
                     echo str_repeat(' ', $width - 14 - strlen($source));
                 }
                 echo $line . PHP_EOL;
             }
             //end foreach
         }
         //end if
     }
     //end foreach
     echo str_repeat('-', $width) . PHP_EOL;
     echo "[1m" . 'A TOTAL OF ' . $errorsShown . ' SNIFF VIOLATION';
     if ($errorsShown !== 1) {
         echo 'S';
     }
     echo ' WERE COMMITTED BY ' . count($this->_authorCache) . ' AUTHOR';
     if (count($this->_authorCache) !== 1) {
         echo 'S';
     }
     echo "[0m";
     if ($totalFixable > 0) {
         if ($showSources === true) {
             echo PHP_EOL . str_repeat('-', $width) . PHP_EOL;
             echo "[1mPHPCBF CAN FIX THE {$fixableSources} MARKED SOURCES AUTOMATICALLY ({$totalFixable} VIOLATIONS IN TOTAL)[0m";
         } else {
             echo PHP_EOL . str_repeat('-', $width) . PHP_EOL;
             echo "[1mPHPCBF CAN FIX {$totalFixable} OF THESE SNIFF VIOLATIONS AUTOMATICALLY[0m";
         }
     }
     echo PHP_EOL . str_repeat('-', $width) . PHP_EOL . PHP_EOL;
     if ($toScreen === true && PHP_CODESNIFFER_INTERACTIVE === false) {
         PHP_CodeSniffer_Reporting::printRunTime();
     }
 }
开发者ID:squizlabs,项目名称:php_codesniffer,代码行数:101,代码来源:VersionControl.php

示例8: printErrorReport

 /**
  * Prints the error report for the run.
  *
  * Note that this function may actually print multiple reports
  * as the user may have specified a number of output formats.
  *
  * @param PHP_CodeSniffer $phpcs       The PHP_CodeSniffer object containing
  *                                     the errors.
  * @param array           $reports     A list of reports to print.
  * @param bool            $showSources TRUE if report should show error sources
  *                                     (not used by all reports).
  * @param string          $reportFile  A default file to log report output to.
  * @param int             $reportWidth How wide the screen reports should be.
  *
  * @return int The number of error and warning messages shown.
  */
 public function printErrorReport(PHP_CodeSniffer $phpcs, $reports, $showSources, $reportFile, $reportWidth)
 {
     if (empty($reports) === true) {
         $reports['full'] = $reportFile;
     }
     $errors = 0;
     $toScreen = false;
     foreach ($reports as $report => $output) {
         if ($output === null) {
             $output = $reportFile;
         }
         if ($reportFile === null) {
             $toScreen = true;
         }
         // We don't add errors here because the number of
         // errors reported by each report type will always be the
         // same, so we really just need 1 number.
         $errors = $phpcs->reporting->printReport($report, $showSources, $output, $reportWidth);
     }
     // Only print timer output if no reports were
     // printed to the screen so we don't put additional output
     // in something like an XML report. If we are printing to screen,
     // the report types would have already worked out who should
     // print the timer info.
     if ($toScreen === false && PHP_CODESNIFFER_INTERACTIVE === false) {
         PHP_CodeSniffer_Reporting::printRunTime();
     }
     // They should all return the same value, so it
     // doesn't matter which return value we end up using.
     return $errors;
 }
开发者ID:eduardobenito10,项目名称:jenkins-php-quickstart,代码行数:47,代码来源:CLI.php

示例9: generate

 /**
  * Generates a summary of errors and warnings for each file processed.
  *
  * @param string  $cachedData    Any partial report data that was returned from
  *                               generateFileReport during the run.
  * @param int     $totalFiles    Total number of files processed during the run.
  * @param int     $totalErrors   Total number of errors found during the run.
  * @param int     $totalWarnings Total number of warnings found during the run.
  * @param int     $totalFixable  Total number of problems that can be fixed.
  * @param boolean $showSources   Show sources?
  * @param int     $width         Maximum allowed line width.
  * @param boolean $toScreen      Is the report being printed to screen?
  *
  * @return void
  */
 public function generate($cachedData, $totalFiles, $totalErrors, $totalWarnings, $totalFixable, $showSources = false, $width = 80, $toScreen = true)
 {
     if (empty($this->_reportFiles) === true) {
         return;
     }
     // Make sure the report width isn't too big.
     $maxLength = 0;
     foreach ($this->_reportFiles as $file => $data) {
         $maxLength = max($maxLength, $data['strlen']);
     }
     $width = min($width, $maxLength + 21);
     $width = max($width, 70);
     echo PHP_EOL . "[1m" . 'PHP CODE SNIFFER REPORT SUMMARY' . "[0m" . PHP_EOL;
     echo str_repeat('-', $width) . PHP_EOL;
     echo "[1m" . 'FILE' . str_repeat(' ', $width - 20) . 'ERRORS  WARNINGS' . "[0m" . PHP_EOL;
     echo str_repeat('-', $width) . PHP_EOL;
     foreach ($this->_reportFiles as $file => $data) {
         $padding = $width - 18 - $data['strlen'];
         if ($padding < 0) {
             $file = '...' . substr($file, $padding * -1 + 3);
             $padding = 0;
         }
         echo $file . str_repeat(' ', $padding) . '  ';
         if ($data['errors'] !== 0) {
             echo "[31m" . $data['errors'] . "[0m";
             echo str_repeat(' ', 8 - strlen((string) $data['errors']));
         } else {
             echo '0       ';
         }
         if ($data['warnings'] !== 0) {
             echo "[33m" . $data['warnings'] . "[0m";
         } else {
             echo '0';
         }
         echo PHP_EOL;
     }
     //end foreach
     echo str_repeat('-', $width) . PHP_EOL;
     echo "[1mA TOTAL OF {$totalErrors} ERROR";
     if ($totalErrors !== 1) {
         echo 'S';
     }
     echo ' AND ' . $totalWarnings . ' WARNING';
     if ($totalWarnings !== 1) {
         echo 'S';
     }
     echo ' WERE FOUND IN ' . $totalFiles . ' FILE';
     if ($totalFiles !== 1) {
         echo 'S';
     }
     echo "[0m";
     if ($totalFixable > 0) {
         echo PHP_EOL . str_repeat('-', $width) . PHP_EOL;
         echo "[1mPHPCBF CAN FIX {$totalFixable} OF THESE SNIFF VIOLATIONS AUTOMATICALLY[0m";
     }
     echo PHP_EOL . str_repeat('-', $width) . PHP_EOL . PHP_EOL;
     if ($toScreen === true && PHP_CODESNIFFER_INTERACTIVE === false) {
         PHP_CodeSniffer_Reporting::printRunTime();
     }
 }
开发者ID:itliuchang,项目名称:test,代码行数:75,代码来源:Summary.php

示例10: generate

 /**
  * Generates a summary of errors and warnings for each file processed.
  *
  * @param string  $cachedData    Any partial report data that was returned from
  *                               generateFileReport during the run.
  * @param int     $totalFiles    Total number of files processed during the run.
  * @param int     $totalErrors   Total number of errors found during the run.
  * @param int     $totalWarnings Total number of warnings found during the run.
  * @param int     $totalFixable  Total number of problems that can be fixed.
  * @param boolean $showSources   Show sources?
  * @param int     $width         Maximum allowed line width.
  * @param boolean $toScreen      Is the report being printed to screen?
  *
  * @return void
  */
 public function generate($cachedData, $totalFiles, $totalErrors, $totalWarnings, $totalFixable, $showSources = false, $width = 80, $toScreen = true)
 {
     if ($cachedData === '') {
         return;
     }
     echo PHP_EOL . 'PHP CODE SNIFFER REPORT SUMMARY' . PHP_EOL;
     echo str_repeat('-', $width) . PHP_EOL;
     echo 'FILE' . str_repeat(' ', $width - 20) . 'ERRORS  WARNINGS' . PHP_EOL;
     echo str_repeat('-', $width) . PHP_EOL;
     echo $cachedData;
     echo str_repeat('-', $width) . PHP_EOL;
     echo 'A TOTAL OF ' . $totalErrors . ' ERROR';
     if ($totalErrors !== 1) {
         echo 'S';
     }
     echo ' AND ' . $totalWarnings . ' WARNING';
     if ($totalWarnings !== 1) {
         echo 'S';
     }
     echo ' WERE FOUND IN ' . $totalFiles . ' FILE';
     if ($totalFiles !== 1) {
         echo 'S';
     }
     if ($totalFixable > 0) {
         echo PHP_EOL . str_repeat('-', $width) . PHP_EOL;
         echo 'PHPCBF CAN FIX ' . $totalFixable . ' OF THESE SNIFF VIOLATIONS AUTOMATICALLY';
     }
     echo PHP_EOL . str_repeat('-', $width) . PHP_EOL . PHP_EOL;
     if ($toScreen === true && PHP_CODESNIFFER_INTERACTIVE === false) {
         PHP_CodeSniffer_Reporting::printRunTime();
     }
 }
开发者ID:eredi93,项目名称:forms,代码行数:47,代码来源:Summary.php


注:本文中的PHP_CodeSniffer_Reporting::printRunTime方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。