3
* Summary report for PHP_CodeSniffer.
8
* @package PHP_CodeSniffer
9
* @author Gabriele Santini <gsantini@sqli.com>
10
* @author Greg Sherwood <gsherwood@squiz.net>
11
* @copyright 2009-2014 SQLI <www.sqli.com>
12
* @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600)
13
* @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
14
* @link http://pear.php.net/package/PHP_CodeSniffer
18
* Summary report for PHP_CodeSniffer.
23
* @package PHP_CodeSniffer
24
* @author Gabriele Santini <gsantini@sqli.com>
25
* @author Greg Sherwood <gsherwood@squiz.net>
26
* @copyright 2009-2014 SQLI <www.sqli.com>
27
* @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600)
28
* @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
29
* @version Release: 1.5.5
30
* @link http://pear.php.net/package/PHP_CodeSniffer
32
class PHP_CodeSniffer_Reports_Summary implements PHP_CodeSniffer_Report
37
* Generate a partial report for a single processed file.
39
* If verbose output is enabled, results are shown for all files, even if
40
* they have no errors or warnings. If verbose output is disabled, we only
41
* show files that have at least one warning or error.
43
* @param array $report Prepared report data.
44
* @param boolean $showSources Show sources?
45
* @param int $width Maximum allowed line width.
49
public function generateFileReport(
54
if (PHP_CODESNIFFER_VERBOSITY === 0
55
&& $report['errors'] === 0
56
&& $report['warnings'] === 0
62
$width = max($width, 70);
63
$file = $report['filename'];
65
$padding = ($width - 18 - strlen($file));
67
$file = '...'.substr($file, (($padding * -1) + 3));
71
echo $file.str_repeat(' ', $padding).' ';
72
echo $report['errors'];
73
echo str_repeat(' ', (8 - strlen((string) $report['errors'])));
74
echo $report['warnings'];
79
}//end generateFileReport()
83
* Generates a summary of errors and warnings for each file processed.
85
* @param string $cachedData Any partial report data that was returned from
86
* generateFileReport during the run.
87
* @param int $totalFiles Total number of files processed during the run.
88
* @param int $totalErrors Total number of errors found during the run.
89
* @param int $totalWarnings Total number of warnings found during the run.
90
* @param boolean $showSources Show sources?
91
* @param int $width Maximum allowed line width.
92
* @param boolean $toScreen Is the report being printed to screen?
96
public function generate(
105
if ($cachedData === '') {
109
echo PHP_EOL.'PHP CODE SNIFFER REPORT SUMMARY'.PHP_EOL;
110
echo str_repeat('-', $width).PHP_EOL;
111
echo 'FILE'.str_repeat(' ', ($width - 20)).'ERRORS WARNINGS'.PHP_EOL;
112
echo str_repeat('-', $width).PHP_EOL;
116
echo str_repeat('-', $width).PHP_EOL;
117
echo 'A TOTAL OF '.$totalErrors.' ERROR(S) ';
118
echo 'AND '.$totalWarnings.' WARNING(S) ';
120
echo 'WERE FOUND IN '.$totalFiles.' FILE(S)'.PHP_EOL;
121
echo str_repeat('-', $width).PHP_EOL.PHP_EOL;
123
if ($toScreen === true
124
&& PHP_CODESNIFFER_INTERACTIVE === false
125
&& class_exists('PHP_Timer', false) === true
127
echo PHP_Timer::resourceUsage().PHP_EOL.PHP_EOL;