public function SiteAuditCheckCodebasePhpMessDetection::getResultWarn in Site Audit 8.2
Implements \SiteAudit\Check\Abstract\getResultWarn().
Overrides SiteAuditCheckAbstract::getResultWarn
File
- Check/
Codebase/ PhpMessDetection.php, line 55 - Contains \SiteAudit\Check\Codebase\PhpMessDetection.
Class
- SiteAuditCheckCodebasePhpMessDetection
- Class SiteAuditCheckCodebasePhpMessDetection.
Code
public function getResultWarn() {
$ret_val = '';
if (drush_get_option('html') == TRUE) {
$ret_val .= '<table class="table table-condensed">';
$ret_val .= '<thead><tr><th>' . dt('Line') . '</th><th>' . dt('Type') . '</th><th>' . dt('Action') . '</th></tr></thead>';
foreach ($this->registry['phpmd_out'] as $filename => $violations) {
$ret_val .= "<tr align='center'><td colspan='3'>File: {$filename}</td></tr>";
foreach ($violations as $violation) {
$begin = $violation['beginline'];
$end = $violation['endline'];
$rule = $violation['rule'];
$url = $violation['externalInfoUrl'];
$ret_val .= "<tr><td>{$begin} to {$end}</td><td><a href='{$url}'>{$rule}</a></td><td>{$violation}</td></tr>";
}
}
$ret_val .= '</table>';
}
else {
$rows = 0;
foreach ($this->registry['phpmd_out'] as $filename => $violations) {
if ($rows++ > 0) {
$ret_val .= PHP_EOL;
if (!drush_get_option('json')) {
$ret_val .= str_repeat(' ', 4);
}
}
$ret_val .= dt('Filename: @filename, Violations: @total', array(
'@filename' => $filename,
'@total' => count($violations),
));
foreach ($violations as $violation) {
$ret_val .= PHP_EOL;
if (!drush_get_option('json')) {
$ret_val .= str_repeat(' ', 6);
}
$begin = $violation['beginline'];
$end = $violation['endline'];
$rule = $violation['rule'];
$action = trim((string) $violation);
$ret_val .= "{$begin} to {$end} : {$rule} - {$action}";
}
}
}
return $ret_val;
}