You are here

public function SiteAuditCheckExtensionsDuplicate::getResultWarn in Site Audit 7

Same name and namespace in other branches
  1. 8.2 Check/Extensions/Duplicate.php \SiteAuditCheckExtensionsDuplicate::getResultWarn()

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

Overrides SiteAuditCheckAbstract::getResultWarn

File

Check/Extensions/Duplicate.php, line 46
Contains \SiteAudit\Check\Extensions\Duplicate.

Class

SiteAuditCheckExtensionsDuplicate
Class SiteAuditCheckExtensionsDuplicate.

Code

public function getResultWarn() {
  $ret_val = dt('The following duplicate extensions were found:');
  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('Paths') . '</th></thead>';
    $ret_val .= '<tbody>';
    foreach ($this->registry['extensions_dupe'] as $name => $extension_infos) {
      $ret_val .= '<tr><td>' . $name . '</td>';
      $paths = array();
      foreach ($extension_infos as $extension_info) {
        $extension = $extension_info['path'];
        if ($extension_info['version']) {
          $extension .= ' (' . $extension_info['version'] . ')';
        }
        $paths[] = $extension;
      }
      $ret_val .= '<td>' . implode('<br/>', $paths) . '</td></tr>';
    }
    $ret_val .= '</tbody>';
    $ret_val .= '</table>';
  }
  else {
    foreach ($this->registry['extensions_dupe'] as $name => $extension_infos) {
      $ret_val .= PHP_EOL;
      if (!drush_get_option('json')) {
        $ret_val .= str_repeat(' ', 6);
      }
      $ret_val .= $name . PHP_EOL;
      $extension_list = '';
      foreach ($extension_infos as $extension_info) {
        $extension_list .= str_repeat(' ', 8);
        $extension_list .= $extension_info['path'];
        if ($extension_info['version']) {
          $extension_list .= ' (' . $extension_info['version'] . ')';
        }
        $extension_list .= PHP_EOL;
      }
      $ret_val .= rtrim($extension_list);
    }
  }
  return $ret_val;
}