public function SiteAuditCheckCodebaseGitContributions::getResultInfo in Site Audit 8.2
Implements \SiteAudit\Check\Abstract\getResultInfo().
Overrides SiteAuditCheckAbstract::getResultInfo
File
- Check/
Codebase/ GitContributions.php, line 34 - Contains \SiteAudit\Check\Codebase\GitContributions.
Class
- SiteAuditCheckCodebaseGitContributions
- Class SiteAuditCheckCodebaseGitContributions.
Code
public function getResultInfo() {
if (isset($this->registry['not_git'])) {
return dt('The site is not stored in Git.');
}
if (isset($this->registry['git_remote'])) {
return dt("The repository contains the entire Drupal contribution history and will be ignored.");
}
$ret_val = '';
if (drush_get_option('html') == TRUE) {
$ret_val .= '<table class="table table-condensed">';
$ret_val .= '<thead><tr><th>' . dt('Author') . '</th><th>' . dt('Lines Inserted') . '</th><th>' . dt('Lines Deleted') . '</th><th>' . dt('Percentage Contribution') . '</th></tr></thead>';
foreach ($this->registry['git_contribution_percentage'] as $user => $percentage) {
$added = number_format($this->registry['git_contribution'][$user]['inserted']);
$deleted = number_format($this->registry['git_contribution'][$user]['deleted']);
$ret_val .= "<tr><td>{$user}</td><td>{$added}</td><td>{$deleted}</td><td>{$percentage}%</td></tr>";
}
$ret_val .= '</table>';
}
else {
$ret_val = dt('Author: Inserted | Deleted | Percentage') . PHP_EOL;
if (!drush_get_option('json')) {
$ret_val .= str_repeat(' ', 4);
}
$ret_val .= '-----------------------------';
foreach ($this->registry['git_contribution_percentage'] as $user => $percentage) {
$ret_val .= PHP_EOL;
if (!drush_get_option('json')) {
$ret_val .= str_repeat(' ', 4);
}
$added = number_format($this->registry['git_contribution'][$user]['inserted']);
$deleted = number_format($this->registry['git_contribution'][$user]['deleted']);
$ret_val .= "{$user}: {$added} | {$deleted} | {$percentage}%";
}
}
return $ret_val;
}