You are here

class PasswordPolicyValidation in Password Policy 8.3

A construct to organize validation of a password policy.

@package Drupal\password_policy

Hierarchy

Expanded class hierarchy of PasswordPolicyValidation

6 files declare their use of PasswordPolicyValidation
CharacterTypes.php in password_policy_character_types/src/Plugin/PasswordConstraint/CharacterTypes.php
ConsecutiveCharacters.php in password_policy_consecutive/src/Plugin/PasswordConstraint/ConsecutiveCharacters.php
PasswordCharacter.php in password_policy_characters/src/Plugin/PasswordConstraint/PasswordCharacter.php
PasswordHistory.php in password_policy_history/src/Plugin/PasswordConstraint/PasswordHistory.php
PasswordLength.php in password_policy_length/src/Plugin/PasswordConstraint/PasswordLength.php

... See full list

File

src/PasswordPolicyValidation.php, line 10

Namespace

Drupal\password_policy
View source
class PasswordPolicyValidation {
  protected $error = NULL;
  protected $valid = TRUE;

  /**
   * Set error message and mark as invalid.
   */
  public function setErrorMessage($error) {
    $this->valid = FALSE;
    $this->error = $error;
  }

  /**
   * Output error message.
   *
   * @return string
   *   A message representing the error message of the policy's constraints.
   */
  public function getErrorMessage() {
    return $this->error;
  }

  /**
   * Output validation state.
   *
   * @return bool
   *   Whether or not the policy has an error.
   */
  public function isValid() {
    return $this->valid;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
PasswordPolicyValidation::$error protected property
PasswordPolicyValidation::$valid protected property
PasswordPolicyValidation::getErrorMessage public function Output error message.
PasswordPolicyValidation::isValid public function Output validation state.
PasswordPolicyValidation::setErrorMessage public function Set error message and mark as invalid.