You are here

protected function Matcher::getMatchers in Password Strength 8.2

Load enabled Matcher objects to match against a password.

Return value

array Array of classes implementing MatchInterface

1 call to Matcher::getMatchers()
Matcher::getMatches in src/Matcher.php
Get matches for a password.

File

src/Matcher.php, line 37

Class

Matcher

Namespace

Drupal\password_strength

Code

protected function getMatchers() {
  $config = \Drupal::config('password_strength.settings');
  $all_matchers = array_values($config
    ->get('enabled_matchers'));
  $enabled_matchers = array();
  for ($i = count($all_matchers) - 1; $i >= 0; $i--) {
    if ($all_matchers[$i]) {
      $def = \Drupal::service('plugin.manager.password_strength.password_strength_matcher')
        ->getDefinition($all_matchers[$i]);
      $enabled_matchers[] = $def['class'];
    }
  }
  return $enabled_matchers;
}