src/Matchers/L33tMatch.php
public static function match($password, array $userInputs = [])
    {
        // Translate l33t password and dictionary match the translated password.
        $map = static::getSubstitutions($password);
        $indexSubs = array_filter($map);
        if (empty($indexSubs)) {
            return [];
        }
        $translatedWord = static::translate($password, $map);

        $matches = [];
        $dicts = static::getRankedDictionaries();
        foreach ($dicts as $name => $dict) {
            $results = static::dictionaryMatch($translatedWord, $dict);
            foreach ($results as $result) {
                // Set substituted elements.
                $result['sub'] = [];
                $result['sub_display'] = [];
                foreach ($indexSubs as $i => $t) {
                    $result['sub'][$password[$i]] = $t;
                    $result['sub_display'][] = "{$password[$i]} -> ${t}";
                }
                $result['sub_display'] = implode(', ', $result['sub_display']);
                $result['dictionary_name'] = $name;
                // Replace translated token with orignal password token.
                $token = substr($password, $result['begin'], $result['end'] - $result['begin'] + 1);
                $matches[] = new static($password, $result['begin'], $result['end'], $token, $result);
            }
        }

        return $matches;
    }
public static function match($password, array $userInputs = [])
    {
        // Translate l33t password and dictionary match the translated password.
        $map = static::getSubstitutions($password);
        $indexSubs = array_filter($map);
        if (empty($indexSubs)) {
            return [];
        }
        $translatedWord = static::translate($password, $map);

        $matches = [];
        $dicts = static::getRankedDictionaries();
        foreach ($dicts as $name => $dict) {
            $results = static::dictionaryMatch($translatedWord, $dict);
            foreach ($results as $result) {
                // Set substituted elements.
                $result['sub'] = [];
                $result['sub_display'] = [];
                foreach ($indexSubs as $i => $t) {
                    $result['sub'][$password[$i]] = $t;
                    $result['sub_display'][] = "{$password[$i]} -> ${t}";
                }
                $result['sub_display'] = implode(', ', $result['sub_display']);
                $result['dictionary_name'] = $name;
                // Replace translated token with orignal password token.
                $token = substr($password, $result['begin'], $result['end'] - $result['begin'] + 1);
                $matches[] = new static($password, $result['begin'], $result['end'], $token, $result);
            }
        }

        return $matches;
    }
public static function match ( $ password , array $ userInputs = [ ] ) { // Translate l33t password and dictionary match the translated password. $ map = static :: getSubstitutions ( $ password ) ; $ indexSubs = array_filter ( $ map ) ; if ( empty ( $ indexSubs ) ) { return [ ] ; } $ translatedWord = static :: translate ( $ password , $ map ) ; $ matches = [ ] ; $ dicts = static :: getRankedDictionaries ( ) ; foreach ( $ dicts as $ name => $ dict ) { $ results = static :: dictionaryMatch ( $ translatedWord , $ dict ) ; foreach ( $ results as $ result ) { // Set substituted elements. $ result [ 'sub' ] = [ ] ; $ result [ 'sub_display' ] = [ ] ; foreach ( $ indexSubs as $ i => $ t ) { $ result [ 'sub' ] [ $ password [ $ i ] ] = $ t ; $ result [ 'sub_display' ] [ ] = "{$password[$i]} -> ${t}" ; } $ result [ 'sub_display' ] = implode ( ', ' , $ result [ 'sub_display' ] ) ; $ result [ 'dictionary_name' ] = $ name ; // Replace translated token with orignal password token. $ token = substr ( $ password , $ result [ 'begin' ] , $ result [ 'end' ] - $ result [ 'begin' ] + 1 ) ; $ matches [ ] = new static ( $ password , $ result [ 'begin' ] , $ result [ 'end' ] , $ token , $ result ) ; } } return $ matches ; }
Match occurences of l33t words in password to dictionary words.

@copydoc Match::match()

@param       $password
@param array $userInputs

@return array
Match occurences of l33t words in password to dictionary words .