public function SiteAuditCheckFrontEndTemplateFiles::getResultWarn in Site Audit 7
Implements \SiteAudit\Check\Abstract\getResultWarn().
Overrides SiteAuditCheckAbstract::getResultWarn
File
- Check/
FrontEnd/ TemplateFiles.php, line 46 - Contains \SiteAudit\Check\BestPractices\TemplateFiles.
Class
- SiteAuditCheckFrontEndTemplateFiles
- Class SiteAuditCheckFrontEndTemplateFiles.
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('Code') . '</th></tr></thead>';
foreach ($this->registry['template_logic'] as $filename => $violations) {
$ret_val .= "<tr align='center'><td colspan='3'>File: {$filename}</td></tr>";
foreach ($violations as $violation) {
$ret_val .= '<tr><td>' . $violation[0] . '</td><td>' . htmlspecialchars($violation[1]) . '</td></tr>';
}
}
$ret_val .= '</table>';
}
else {
$rows = 0;
foreach ($this->registry['template_logic'] 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);
}
$ret_val .= 'Line ' . $violation[0] . ' : ' . $violation[1];
}
}
}
return $ret_val;
}