Matcher
in package
Table of Contents
Constants
- DEFAULT_MATCHERS = [\ZxcvbnPhp\Matchers\DateMatch::class, \ZxcvbnPhp\Matchers\DictionaryMatch::class, \ZxcvbnPhp\Matchers\ReverseDictionaryMatch::class, \ZxcvbnPhp\Matchers\L33tMatch::class, \ZxcvbnPhp\Matchers\RepeatMatch::class, \ZxcvbnPhp\Matchers\SequenceMatch::class, \ZxcvbnPhp\Matchers\SpatialMatch::class, \ZxcvbnPhp\Matchers\YearMatch::class]
Properties
- $additionalMatchers : mixed
Methods
- addMatcher() : self
- compareMatches() : int
- getMatches() : array<string|int, MatchInterface>
- Get matches for a password.
- usortStable() : bool
- A stable implementation of usort().
- getMatchers() : array<string|int, mixed>
- Load available Match objects to match against a password.
Constants
DEFAULT_MATCHERS
private
mixed
DEFAULT_MATCHERS
= [\ZxcvbnPhp\Matchers\DateMatch::class, \ZxcvbnPhp\Matchers\DictionaryMatch::class, \ZxcvbnPhp\Matchers\ReverseDictionaryMatch::class, \ZxcvbnPhp\Matchers\L33tMatch::class, \ZxcvbnPhp\Matchers\RepeatMatch::class, \ZxcvbnPhp\Matchers\SequenceMatch::class, \ZxcvbnPhp\Matchers\SpatialMatch::class, \ZxcvbnPhp\Matchers\YearMatch::class]
Properties
$additionalMatchers
private
mixed
$additionalMatchers
= []
Methods
addMatcher()
public
addMatcher(string $className) : self
Parameters
- $className : string
Return values
selfcompareMatches()
public
static compareMatches(BaseMatch $a, BaseMatch $b) : int
Parameters
Return values
intgetMatches()
Get matches for a password.
public
getMatches(string $password[, array<string|int, mixed> $userInputs = [] ]) : array<string|int, MatchInterface>
Parameters
- $password : string
-
Password string to match
- $userInputs : array<string|int, mixed> = []
-
Array of values related to the user (optional)
Tags
Return values
array<string|int, MatchInterface> —Array of Match objects.
usortStable()
A stable implementation of usort().
public
static usortStable(array<string|int, mixed> &$array, callable $value_compare_func) : bool
Whether or not the sort() function in JavaScript is stable or not is implementation-defined. This means it's impossible for us to match all browsers exactly, but since most browsers implement sort() using a stable sorting algorithm, we'll get the highest rate of accuracy by using a stable sort in our code as well.
This function taken from https://github.com/vanderlee/PHP-stable-sort-functions Copyright © 2015-2018 Martijn van der Lee (http://martijn.vanderlee.com). MIT License applies.
Parameters
- $array : array<string|int, mixed>
- $value_compare_func : callable
Return values
boolgetMatchers()
Load available Match objects to match against a password.
protected
getMatchers() : array<string|int, mixed>
Return values
array<string|int, mixed> —Array of classes implementing MatchInterface