Documentation

RepeatMatch extends BaseMatch
in package

Tags
phpstan-consistent-constructor

Table of Contents

Constants

ANCHORED_LAZY_MATCH  = '/^(.+?)\1+$/u'
GREEDY_MATCH  = '/(.+)\1+/u'
LAZY_MATCH  = '/(.+?)\1+/u'

Properties

$baseGuesses  : int
$baseMatches  : array<string|int, MatchInterface>
$begin  : mixed
$end  : mixed
$password  : mixed
$pattern  : mixed
$repeatCount  : int
$repeatedChar  : string
$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.
getFeedback()  : array{'warning': string, "suggestions": string[]}
Get feedback to a user based on the match.
getGuesses()  : float
getGuessesLog10()  : float
match()  : array<string|int, RepeatMatch>
Match 3 or more repeated characters.
getMinimumGuesses()  : float
getRawGuesses()  : float

Constants

ANCHORED_LAZY_MATCH

public mixed ANCHORED_LAZY_MATCH = '/^(.+?)\1+$/u'

GREEDY_MATCH

public mixed GREEDY_MATCH = '/(.+)\1+/u'

Properties

$baseGuesses

public int $baseGuesses

The number of guesses required for the repeated section itself.

$baseMatches

public array<string|int, MatchInterface> $baseMatches = []

An array of matches for the repeated section itself.

$repeatCount

public int $repeatCount

The number of times the repeated section is repeated.

$repeatedChar

public string $repeatedChar

The string that was repeated in the token.

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: [repeated_char, base_guesses, base_matches, repeat_count].

binom()

Calculate binomial coefficient (n choose k).

public static binom(int $n, int $k) : float
Parameters
$n : int
$k : int
Return values
float

findAll()

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') ) )

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
float

getGuessesLog10()

public getGuessesLog10() : float
Return values
float

match()

Match 3 or more repeated characters.

public static match(string $password[, array<string|int, mixed> $userInputs = [] ]) : array<string|int, RepeatMatch>
Parameters
$password : string
$userInputs : array<string|int, mixed> = []
Return values
array<string|int, RepeatMatch>

getMinimumGuesses()

protected getMinimumGuesses() : float
Return values
float

getRawGuesses()

protected getRawGuesses() : float
Return values
float

        
On this page

Search results