src/Phpass/Strength/Adapter/Wolfram.php
protected function _calculateConsecutiveTokenScore($class)
    {
        $score = 0;
        $pattern = '/[^a-zA-Z0-9]{2,}/';

        if ($class == self::CLASS_LETTER) {
            $pattern = '/[a-zA-Z]{2,}/';
        }

        if ($class == self::CLASS_UPPER) {
            $pattern = '/[A-Z]{2,}/';
        }

        if ($class == self::CLASS_LOWER) {
            $pattern = '/[a-z]{2,}/';
        }

        if ($class == self::CLASS_NUMBER) {
            $pattern = '/[0-9]{2,}/';
        }

        $matches = array ();
        preg_match_all($pattern, $this->_password, $matches);
        foreach ($matches[0] as $match) {
            $score -= (strlen($match) - 1) * 2;
        }

        return $score;
    }
protected function _calculateConsecutiveTokenScore($class)
    {
        $score = 0;
        $pattern = '/[^a-zA-Z0-9]{2,}/';

        if ($class == self::CLASS_LETTER) {
            $pattern = '/[a-zA-Z]{2,}/';
        }

        if ($class == self::CLASS_UPPER) {
            $pattern = '/[A-Z]{2,}/';
        }

        if ($class == self::CLASS_LOWER) {
            $pattern = '/[a-z]{2,}/';
        }

        if ($class == self::CLASS_NUMBER) {
            $pattern = '/[0-9]{2,}/';
        }

        $matches = array ();
        preg_match_all($pattern, $this->_password, $matches);
        foreach ($matches[0] as $match) {
            $score -= (strlen($match) - 1) * 2;
        }

        return $score;
    }
protected function _calculateConsecutiveTokenScore ( $ class ) { $ score = 0 ; $ pattern = '/[^a-zA-Z0-9]{2,}/' ; if ( $ class == self :: CLASS_LETTER ) { $ pattern = '/[a-zA-Z]{2,}/' ; } if ( $ class == self :: CLASS_UPPER ) { $ pattern = '/[A-Z]{2,}/' ; } if ( $ class == self :: CLASS_LOWER ) { $ pattern = '/[a-z]{2,}/' ; } if ( $ class == self :: CLASS_NUMBER ) { $ pattern = '/[0-9]{2,}/' ; } $ matches = array ( ) ; preg_match_all ( $ pattern , $ this -> _password , $ matches ) ; foreach ( $ matches [ 0 ] as $ match ) { $ score -= ( strlen ( $ match ) - 1 ) * 2 ; } return $ score ; }
Return the score for consectutive tokens of the same class.

@param string $class
The token class on which to base the calculation.
@return integer
Return the score for consectutive tokens of the same class .