You are here

public function SiteAuditReportAbstract::getCheckNames in Site Audit 8.2

Same name and namespace in other branches
  1. 7 Report/Abstract.php \SiteAuditReportAbstract::getCheckNames()

Get the names of all the checks within the report.

Uses the key 'checks' within the command to populate. Order matters, so if you implement hook_drush_command_alter(), try to add checks in a logical order, IE don't check for something specific about Views if Views is disabled.

Return value

array Machine readable names.

1 call to SiteAuditReportAbstract::getCheckNames()
SiteAuditReportAbstract::__construct in Report/Abstract.php
Constructor; loads and executes checks based on the name of this report.

File

Report/Abstract.php, line 335
Contains \SiteAudit\Report\Abstract.

Class

SiteAuditReportAbstract
Class SiteAuditReportAbstract.

Code

public function getCheckNames() {
  $commands = drush_get_commands();

  // Guess the name of the Drush command.
  $command_name_pieces = preg_split('/(?=[A-Z])/', get_called_class());
  unset($command_name_pieces[0], $command_name_pieces[1], $command_name_pieces[3]);
  $command_name = strtolower(implode('-', $command_name_pieces));
  $command = $commands[$command_name];
  drush_command_invoke_all_ref('drush_command_alter', $command);
  $checks = array();
  foreach ($command['checks'] as $check) {
    if (is_array($check)) {
      $checks[] = $check['name'];
      require_once $check['location'];
    }
    else {
      $checks[] = $check;
      $base_class_name = 'SiteAuditCheck' . $this
        ->getReportName();
      $class_name = $base_class_name . $check;
      if (!class_exists($class_name)) {
        require_once SITE_AUDIT_BASE_PATH . "/Check/{$this->getReportName()}/{$check}.php";
      }
    }
  }
  return $checks;
}