Introduced various bug fixes and improvements

This commit is contained in:
Zi Xing 2021-09-18 08:35:26 -04:00
parent 6a2c0fb118
commit ff7ba8a226
6 changed files with 24 additions and 6 deletions

View File

@ -0,0 +1,16 @@
<?php
namespace Zxcvbn\Abstracts;
abstract class ScoreDefinitions
{
const ExtremelyGuessable = 0;
const VeryGuessable = 1;
const SomewhatGuessable = 2;
const SafelyUnguessable = 3;
const VeryUnguessable = 4;
}

View File

@ -83,8 +83,8 @@
$matcher = new Matcher();
$baseAnalysis = $scorer->getMostGuessableMatchSequence($repeatedChar, $matcher->getMatches($repeatedChar));
$baseMatches = $baseAnalysis['sequence'];
$baseGuesses = $baseAnalysis['guesses'];
$baseMatches = $baseAnalysis->Sequence;
$baseGuesses = $baseAnalysis->Guesses;
$repeatCount = mb_strlen($match[0]['token']) / mb_strlen($repeatedChar);

View File

@ -146,6 +146,8 @@ namespace Zxcvbn\Classes\Matchers;
$curChar = mb_substr($password, $j, 1);
foreach ($adjacents as $adj)
{
if($adj == null)
continue;
$curDirection += 1;
$curCharPos = static::indexOf($adj, $curChar);
if ($adj !== null && $curCharPos !== -1)

View File

@ -17,9 +17,9 @@
public static function match(string $password, array $userInputs = []);
/**
* @return integer
* @return integer|float
*/
public function getGuesses(): int;
public function getGuesses();
/**
* @return float

View File

@ -24,7 +24,7 @@
* @param string $warning
* @param array $Suggestions
*/
public function __construct(string $warning=(string)null, array $Suggestions=[])
public function __construct(string $warning='', array $Suggestions=[])
{
$this->Warning = $warning;
$this->Suggestions = $Suggestions;

View File

@ -37,7 +37,7 @@
$this->matcher = new Matcher();
$this->scorer = new Scorer();
$this->timeEstimator = new TimeEstimator();
$this->feedback = new Feedback();
$this->feedback = new FeedbackUtilities();
}
/**