SequenceMatch
extends BaseMatch
in package
Tags
Table of Contents
Constants
- MAX_DELTA = 5
Properties
- $ascending : bool
- $begin : mixed
- $end : mixed
- $password : mixed
- $pattern : mixed
- $sequenceName : string
- $sequenceSpace : int
- $token : mixed
Methods
- __construct() : mixed
- binom() : float
- Calculate binomial coefficient (n choose k).
- findAll() : array<string|int, mixed>
- Find all occurrences of regular expression in a string.
- findSequenceMatch() : mixed
- getFeedback() : array{'warning': string, "suggestions": string[]}
- Get feedback to a user based on the match.
- getGuesses() : float
- getGuessesLog10() : float
- match() : array<string|int, SequenceMatch>
- Match sequences of three or more characters.
- getMinimumGuesses() : float
- getRawGuesses() : float
Constants
MAX_DELTA
public
mixed
MAX_DELTA
= 5
Properties
$ascending
public
bool
$ascending
True if the sequence is ascending, and false if it is descending.
$begin
public
mixed
$begin
Tags
$end
public
mixed
$end
Tags
$password
public
mixed
$password
Tags
$pattern
public
mixed
$pattern
= 'sequence'
$sequenceName
public
string
$sequenceName
The name of the detected sequence.
$sequenceSpace
public
int
$sequenceSpace
The number of characters in the complete sequence space.
$token
public
mixed
$token
Tags
Methods
__construct()
public
__construct(string $password, int $begin, int $end, string $token[, array<string|int, mixed> $params = [] ]) : mixed
Parameters
- $password : string
- $begin : int
- $end : int
- $token : string
- $params : array<string|int, mixed> = []
-
An array with keys: [sequenceName, sequenceSpace, ascending].
binom()
Calculate binomial coefficient (n choose k).
public
static binom(int $n, int $k) : float
Use Binomial::binom() instead
Parameters
- $n : int
- $k : int
Return values
floatfindAll()
Find all occurrences of regular expression in a string.
public
static findAll(string $string, string $regex[, int $offset = 0 ]) : array<string|int, mixed>
Parameters
- $string : string
-
String to search.
- $regex : string
-
Regular expression with captures.
- $offset : int = 0
Return values
array<string|int, mixed> —Array of capture groups. Captures in a group have named indexes: 'begin', 'end', 'token'. e.g. fishfish /(fish)/ array( array( array('begin' => 0, 'end' => 3, 'token' => 'fish'), array('begin' => 0, 'end' => 3, 'token' => 'fish') ), array( array('begin' => 4, 'end' => 7, 'token' => 'fish'), array('begin' => 4, 'end' => 7, 'token' => 'fish') ) )
findSequenceMatch()
public
static findSequenceMatch(string $password, int $begin, int $end, int $delta, array<string|int, mixed> &$matches) : mixed
Parameters
- $password : string
- $begin : int
- $end : int
- $delta : int
- $matches : array<string|int, mixed>
getFeedback()
Get feedback to a user based on the match.
public
getFeedback(bool $isSoleMatch) : array{'warning': string, "suggestions": string[]}
Parameters
- $isSoleMatch : bool
-
Whether this is the only match in the password
Return values
array{'warning': string, "suggestions": string[]}getGuesses()
public
getGuesses() : float
Return values
floatgetGuessesLog10()
public
getGuessesLog10() : float
Return values
floatmatch()
Match sequences of three or more characters.
public
static match(string $password[, array<string|int, mixed> $userInputs = [] ]) : array<string|int, SequenceMatch>
Parameters
- $password : string
- $userInputs : array<string|int, mixed> = []
Return values
array<string|int, SequenceMatch>getMinimumGuesses()
protected
getMinimumGuesses() : float
Return values
floatgetRawGuesses()
protected
getRawGuesses() : float