You are here

public function Checklist::getChecks in Security Review 8

Returns every Check.

Return value

\Drupal\security_review\Check[] Array of Checks.

3 calls to Checklist::getChecks()
Checklist::getCheck in src/Checklist.php
Finds a check by its namespace and title.
Checklist::getCheckById in src/Checklist.php
Finds a Check by its id.
Checklist::getEnabledChecks in src/Checklist.php
Returns the enabled Checks.

File

src/Checklist.php, line 74

Class

Checklist
Contains static functions for handling checks throughout every module.

Namespace

Drupal\security_review

Code

public function getChecks() {
  $checks =& static::$cachedChecks;
  if (!empty($checks)) {
    return $checks;
  }

  // Get checks.
  $raw_checks = $this->moduleHandler
    ->invokeAll('security_review_checks');

  // Filter invalid checks.
  $checks = [];
  foreach ($raw_checks as $raw_check) {
    if ($raw_check instanceof Check) {
      $checks[] = $raw_check;
    }
  }

  // Sort the checks.
  usort($checks, [
    $this,
    'compareChecks',
  ]);
  return $checks;
}