class ReuseValidator extends AbstractTranslatableValidator implements ValidatorForSubjectInterface (View source)

Traits

A trait that provides an implementation of ValidatorInterface::isValid

Constants

E_PASSWORD_RECENTLY_USED

Properties

protected array $translatable_requirements from  AbstractTranslatableValidator
protected array $translatable_errors from  AbstractTranslatableValidator
private EntityManagerInterface $entityManager
private int $maxReuse

Methods

setRequirementString(int $code, string|Closure $message)

Set the requirement string to a mixed value.

setErrorString(int $code, string|Closure $message)

Set the error string to a string or to a closure.

string[]
getRequirementStrings()

Get the validator requirements in the form of an array keyed by it's respective error code.

string|mixed
getErrorString(int $code, mixed $value, mixed $default = null)

Get an error string given a code and a passed value.

bool
isTranslatableStringValueValid(Closure|string|mixed $value)

Check to see if $value a valid stand in for a translatable string.

isValid($mixed, ArrayAccess $error = null)

No description

__construct(EntityManagerInterface $entityManager, $maxReuse = 5)

No description

bool
isValidFor(mixed $mixed, mixed $subject = null, ArrayAccess $error = null)

Is this mixed value valid for the specified (optional) subject?

bool
hasBeenUsed(string $string, $id)

Check whether a string has been used against an id

bool
matches(string $string, UsedString $usedString)

Verify whether an obfuscated password matches a tracked used password

EntityManagerInterface
getEntityManager()

Protected accessor method for subclasses

int
getMaxReuseCount()

Protected accessor method for subclasses

int
resolveUserID($subject)

No description

Details

setRequirementString(int $code, string|Closure $message)

Set the requirement string to a mixed value.

Parameters

int $code

The error code

string|Closure $message

Either a plain string, or a closure that returns a string

See also

TranslatableValidatorInterface::setRequirementString

setErrorString(int $code, string|Closure $message)

Set the error string to a string or to a closure.

Parameters

int $code

The error code

string|Closure $message

Either a plain string, or a closure that returns a string

See also

TranslatableValidatorInterface::setErrorString

string[] getRequirementStrings()

Get the validator requirements in the form of an array keyed by it's respective error code.

Return Value

string[]

See also

ValidatorInterface::getRequirementStrings

protected string|mixed getErrorString(int $code, mixed $value, mixed $default = null)

Get an error string given a code and a passed value.

Parameters

int $code
mixed $value
mixed $default

Return Value

string|mixed

Returns a string or $default

protected bool isTranslatableStringValueValid(Closure|string|mixed $value)

Check to see if $value a valid stand in for a translatable string.

Parameters

Closure|string|mixed $value

Return Value

bool

isValid($mixed, ArrayAccess $error = null)

No description

Parameters

$mixed
ArrayAccess $error

See also

ValidatorInterface::isValid

__construct(EntityManagerInterface $entityManager, $maxReuse = 5)

No description

Parameters

EntityManagerInterface $entityManager
$maxReuse

bool isValidFor(mixed $mixed, mixed $subject = null, ArrayAccess $error = null)

Is this mixed value valid for the specified (optional) subject?

Parameters

mixed $mixed

Can be any value

mixed $subject

The subject the value should be valid for

ArrayAccess $error

Return Value

bool

Exceptions

InvalidArgumentException

private bool hasBeenUsed(string $string, $id)

Check whether a string has been used against an id

Parameters

string $string
$id

Return Value

bool

private bool matches(string $string, UsedString $usedString)

Verify whether an obfuscated password matches a tracked used password

Parameters

string $string
UsedString $usedString

Return Value

bool

protected EntityManagerInterface getEntityManager()

Protected accessor method for subclasses

Return Value

EntityManagerInterface

protected int getMaxReuseCount()

Protected accessor method for subclasses

Return Value

int

private int resolveUserID($subject)

No description

Parameters

$subject

Return Value

int

Exceptions

InvalidArgumentException