public function SiteAuditCheckCodebasePhpDeadCodeDetection::getResultWarn in Site Audit 8.2
Implements \SiteAudit\Check\Abstract\getResultWarn().
Overrides SiteAuditCheckAbstract::getResultWarn
File
- Check/
Codebase/ PhpDeadCodeDetection.php, line 58 - Contains \SiteAudit\Check\Codebase\PhpDeadCodeDetection.
Class
- SiteAuditCheckCodebasePhpDeadCodeDetection
- Class SiteAuditCheckCodebasePhpDeadCodeDetection.
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('Lines Of Code') . '</th><th>' . dt('Starting Line Number') . '</th></tr></thead>';
foreach ($this->registry['phpdcd_out'] as $filename => $violations) {
$ret_val .= "<tr align='center'><td colspan='3'>File: {$filename}</td></tr>";
foreach ($violations as $violation) {
$loc = $violation->loc;
$line = $violation->line;
$ret_val .= "<tr><td>{$loc}</td><td>{$line}</td></tr>";
}
}
$ret_val .= '</table>';
}
else {
$rows = 0;
foreach ($this->registry['phpdcd_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);
}
$loc = $violation->loc;
$line = $violation->line;
$ret_val .= "{$loc} lines starting from line {$line}";
}
}
}
return $ret_val;
}