Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. PasswordStrength.php

function PasswordStrength::__construct

Parameters

array<string,mixed>|null $options:

self::STRENGTH_*|null $minScore The minimum required strength of the password (defaults to {@see PasswordStrength::STRENGTH_MEDIUM}):

string[]|null $groups:

Overrides Constraint::__construct

File

vendor/symfony/validator/Constraints/PasswordStrength.php, line 46

Class

PasswordStrength
Validates that the given password has reached a minimum strength.

Namespace

Symfony\Component\Validator\Constraints

Code

public function __construct(?array $options = null, ?int $minScore = null, ?array $groups = null, mixed $payload = null, ?string $message = null) {
    $options['minScore'] ??= self::STRENGTH_MEDIUM;
    parent::__construct($options, $groups, $payload);
    $this->minScore = $minScore ?? $this->minScore;
    $this->message = $message ?? $this->message;
    if ($this->minScore < 1 || 4 < $this->minScore) {
        throw new ConstraintDefinitionException(\sprintf('The parameter "minScore" of the "%s" constraint must be an integer between 1 and 4.', self::class));
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal