src/Phpass/Strength/Adapter/Wolfram.php
protected function _calculateMiddleNumberOrSymbolScore()
    {
        $score = 0;

        // The Wolfram algorithm actually only accounts for numbers, despite
        // what the rule name implies and others have documented.
        //
        // I've decided to account for both numbers and symbols as the rule
        // implies, and treat the Wolfram calculator as bugged. This will mean
        // that the calculations of this class and the Wolfram calculator may
        // not always match.
        foreach (array (self::CLASS_NUMBER, self::CLASS_SYMBOL) as $class) {
            $indices = $this->_getClassIndices($class);
            foreach ($indices as $key => $index) {
                if ($index == 0 || $index == $this->_length - 1) {
                    unset ($indices[$key]);
                }
            }
            $score += count($indices) * 2;
        }

        return $score;
    }
protected function _calculateMiddleNumberOrSymbolScore()
    {
        $score = 0;

        // The Wolfram algorithm actually only accounts for numbers, despite
        // what the rule name implies and others have documented.
        //
        // I've decided to account for both numbers and symbols as the rule
        // implies, and treat the Wolfram calculator as bugged. This will mean
        // that the calculations of this class and the Wolfram calculator may
        // not always match.
        foreach (array (self::CLASS_NUMBER, self::CLASS_SYMBOL) as $class) {
            $indices = $this->_getClassIndices($class);
            foreach ($indices as $key => $index) {
                if ($index == 0 || $index == $this->_length - 1) {
                    unset ($indices[$key]);
                }
            }
            $score += count($indices) * 2;
        }

        return $score;
    }
protected function _calculateMiddleNumberOrSymbolScore ( ) { $ score = 0 ; // The Wolfram algorithm actually only accounts for numbers, despite // what the rule name implies and others have documented. // // I've decided to account for both numbers and symbols as the rule // implies, and treat the Wolfram calculator as bugged. This will mean // that the calculations of this class and the Wolfram calculator may // not always match. foreach ( array ( self :: CLASS_NUMBER , self :: CLASS_SYMBOL ) as $ class ) { $ indices = $ this -> _getClassIndices ( $ class ) ; foreach ( $ indices as $ key => $ index ) { if ( $ index == 0 || $ index == $ this -> _length - 1 ) { unset ( $ indices [ $ key ] ) ; } } $ score += count ( $ indices ) * 2 ; } return $ score ; }
Return the score for special tokens in the middle of the string.

@return integer
Return the score for special tokens in the middle of the string .