You are here

public function SiteAuditCheckExtensionsSecurity::getResultFail in Site Audit 7

Implements \SiteAudit\Check\Abstract\getResultFail().

Overrides SiteAuditCheckAbstract::getResultFail

File

Check/Extensions/Security.php, line 29
Contains \SiteAudit\Check\Extensions\Security.

Class

SiteAuditCheckExtensionsSecurity
Class SiteAuditCheckExtensionsSecurity.

Code

public function getResultFail() {
  $ret_val = 'The following project(s) have security releases available:';
  if (drush_get_option('html')) {
    $ret_val = '<p>' . $ret_val . '</p>';
    $ret_val .= '<table class="table table-condensed">';
    $ret_val .= '<thead><tr><th>' . dt('Name') . '</th><th>' . dt('Existing') . '</th><th>' . dt('Candidate') . '</th></thead>';
    $ret_val .= '<tbody>';
    foreach ($this->registry['projects_security'] as $short_info) {
      $ret_val .= '<tr>';
      $ret_val .= '<td>' . $short_info['label'] . '</td>';
      $ret_val .= '<td>' . $short_info['existing_version'] . '</td>';
      $ret_val .= '<td>' . $short_info['candidate_version'] . '</td>';
      $ret_val .= '</tr>';
    }
    $ret_val .= '</tbody>';
    $ret_val .= '</table>';
  }
  else {
    foreach ($this->registry['projects_security'] as $short_info) {
      $ret_val .= PHP_EOL;
      if (!drush_get_option('json')) {
        $ret_val .= str_repeat(' ', 6);
      }
      $ret_val .= "- {$short_info['label']}: {$short_info['existing_version']} to {$short_info['candidate_version']}";
    }
  }
  return $ret_val;
}