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


PHP PHP_CodeSniffer::printXMLErrorReport方法代码示例

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


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

示例1: printErrorReport

 /**
  * Prints the error report.
  *
  * @param PHP_CodeSniffer $phpcs        The PHP_CodeSniffer object containing
  *                                      the errors.
  * @param string          $report       The type of report to print.
  * @param bool            $showWarnings TRUE if warnings should also be printed.
  * @param bool            $showSources  TRUE if the report should show error sources
  *                                      (not used by all reports).
  * @param string          $reportFile   A file to log the report out to.
  *
  * @return int The number of error and warning messages shown.
  */
 public function printErrorReport($phpcs, $report, $showWarnings, $showSources, $reportFile = '')
 {
     if ($reportFile !== '') {
         ob_start();
     }
     switch ($report) {
         case 'xml':
             $numErrors = $phpcs->printXMLErrorReport($showWarnings);
             break;
         case 'checkstyle':
             $numErrors = $phpcs->printCheckstyleErrorReport($showWarnings);
             break;
         case 'csv':
             $numErrors = $phpcs->printCSVErrorReport($showWarnings);
             break;
         case 'emacs':
             $numErrors = $phpcs->printEmacsErrorReport($showWarnings);
             break;
         case 'summary':
             $numErrors = $phpcs->printErrorReportSummary($showWarnings, $showSources);
             break;
         case 'source':
             $numErrors = $phpcs->printSourceReport($showWarnings, $showSources);
             break;
         default:
             $numErrors = $phpcs->printErrorReport($showWarnings, $showSources);
             break;
     }
     if ($reportFile !== '') {
         $report = ob_get_contents();
         ob_end_flush();
         $report = trim($report);
         file_put_contents($reportFile, "{$report}\n");
     }
     return $numErrors;
 }
开发者ID:jpchristie,项目名称:Scisr,代码行数:49,代码来源:CLI.php

示例2: printErrorReport

 /**
  * Prints the error report.
  *
  * @param PHP_CodeSniffer $phpcs        The PHP_CodeSniffer object containing
  *                                      the errors.
  * @param string          $report       The type of report to print.
  * @param bool            $showWarnings TRUE if warnings should also be printed.
  *
  * @return int The number of error and warning messages shown.
  */
 public function printErrorReport($phpcs, $report, $showWarnings)
 {
     switch ($report) {
         case 'xml':
             $numErrors = $phpcs->printXMLErrorReport($showWarnings);
             break;
         case 'checkstyle':
             $numErrors = $phpcs->printCheckstyleErrorReport($showWarnings);
             break;
         case 'csv':
             $numErrors = $phpcs->printCSVErrorReport($showWarnings);
             break;
         case 'summary':
             $numErrors = $phpcs->printErrorReportSummary($showWarnings);
             break;
         default:
             $numErrors = $phpcs->printErrorReport($showWarnings);
             break;
     }
     return $numErrors;
 }
开发者ID:emma5021,项目名称:toba,代码行数:31,代码来源:CLI.php


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