You are here

public function PasswordLength::getSummary in Password Policy 8.3

Returns a human-readable summary of the constraint.

Return value

string Summary of the constraint behaviors or restriction.

Overrides PasswordConstraintInterface::getSummary

File

password_policy_length/src/Plugin/PasswordConstraint/PasswordLength.php, line 92

Class

PasswordLength
Enforces a specific character length for passwords.

Namespace

Drupal\password_policy_length\Plugin\PasswordConstraint

Code

public function getSummary() {
  switch ($this->configuration['character_operation']) {
    case 'minimum':
      $operation = $this
        ->t('at least');
      break;
    case 'maximum':
      $operation = $this
        ->t('at most');
      break;
  }
  return $this
    ->formatPlural($this->configuration['character_length'], 'Password character length of @operation 1 character', 'Password character length of @operation @characters characters', [
    '@operation' => $operation,
    '@characters' => $this->configuration['character_length'],
  ]);
}