function Junit::generate
Prints all violations for processed files, in a proprietary XML format.
Parameters
string $cachedData Any partial report data that was returned from: generateFileReport during the run.
int $totalFiles Total number of files processed during the run.:
int $totalErrors Total number of errors found during the run.:
int $totalWarnings Total number of warnings found during the run.:
int $totalFixable Total number of problems that can be fixed.:
bool $showSources Show sources?:
int $width Maximum allowed line width.:
bool $interactive Are we running in interactive mode?:
bool $toScreen Is the report being printed to screen?:
Return value
void
Overrides Report::generate
File
-
vendor/
squizlabs/ php_codesniffer/ src/ Reports/ Junit.php, line 103
Class
Namespace
PHP_CodeSniffer\ReportsCode
public function generate($cachedData, $totalFiles, $totalErrors, $totalWarnings, $totalFixable, $showSources = false, $width = 80, $interactive = false, $toScreen = true) {
// Figure out the total number of tests.
$tests = 0;
$matches = [];
preg_match_all('/tests="([0-9]+)"/', $cachedData, $matches);
if (isset($matches[1]) === true) {
foreach ($matches[1] as $match) {
$tests += $match;
}
}
$failures = $totalErrors + $totalWarnings;
echo '<?xml version="1.0" encoding="UTF-8"?>' . PHP_EOL;
echo '<testsuites name="PHP_CodeSniffer ' . Config::VERSION . '" errors="0" tests="' . $tests . '" failures="' . $failures . '">' . PHP_EOL;
echo $cachedData;
echo '</testsuites>' . PHP_EOL;
}