You are here

public function Checklist::getCheck in Security Review 8

Finds a check by its namespace and title.

Parameters

string $namespace: The machine namespace of the requested check.

string $title: The machine title of the requested check.

Return value

null|\Drupal\security_review\Check The Check or null if it doesn't exist.

File

src/Checklist.php, line 200

Class

Checklist
Contains static functions for handling checks throughout every module.

Namespace

Drupal\security_review

Code

public function getCheck($namespace, $title) {
  foreach (static::getChecks() as $check) {
    $same_namespace = $check
      ->getMachineNamespace() == $namespace;
    $same_title = $check
      ->getMachineTitle() == $title;
    if ($same_namespace && $same_title) {
      return $check;
    }
  }
  return NULL;
}