You are here

function _security_review_drush_get_check in Security Review 8

Helper function for parsing input check name strings.

Parameters

string $check_name: The check to get.

Return value

\Drupal\security_review\Check|null The found Check.

1 call to _security_review_drush_get_check()
security_review_drush in ./security_review.drush.inc
Runs a checklist and displays results.

File

./security_review.drush.inc, line 170
Drush commands for Security Review module.

Code

function _security_review_drush_get_check($check_name) {

  /** @var \Drupal\security_review\Checklist $checklist */
  $checklist = Drupal::service('security_review.checklist');

  // Default namespace is Security Review.
  $namespace = 'security_review';
  $title = $check_name;

  // Set namespace and title if explicitly defined.
  if (strpos($check_name, ':') !== FALSE) {
    list($namespace, $title) = explode(':', $check_name);
  }

  // Return the found check if any.
  return $checklist
    ->getCheck($namespace, $title);
}