protected function findMixer(\SecurityLib\Strength $strength)
    {
        $newMixer = null;
        $fallback = null;
        foreach ($this->getMixers() as $mixer) {
            if (!$mixer::test()) {
                continue;
            }
            if ($strength->compare($mixer::getStrength()) == 0) {
                $newMixer = new $mixer();
            } elseif ($strength->compare($mixer::getStrength()) == 1) {
                $fallback = new $mixer();
            }
        }
        if (is_null($newMixer)) {
            if (is_null($fallback)) {
                throw new \RuntimeException('Could not find mixer');
            }

            return $fallback;
        }

        return $newMixer;
    }
protected function findMixer(\SecurityLib\Strength $strength)
    {
        $newMixer = null;
        $fallback = null;
        foreach ($this->getMixers() as $mixer) {
            if (!$mixer::test()) {
                continue;
            }
            if ($strength->compare($mixer::getStrength()) == 0) {
                $newMixer = new $mixer();
            } elseif ($strength->compare($mixer::getStrength()) == 1) {
                $fallback = new $mixer();
            }
        }
        if (is_null($newMixer)) {
            if (is_null($fallback)) {
                throw new \RuntimeException('Could not find mixer');
            }

            return $fallback;
        }

        return $newMixer;
    }
protected function findMixer ( \ SecurityLib \ Strength $ strength ) { $ newMixer = null ; $ fallback = null ; foreach ( $ this -> getMixers ( ) as $ mixer ) { if ( ! $ mixer :: test ( ) ) { continue ; } if ( $ strength -> compare ( $ mixer :: getStrength ( ) ) == 0 ) { $ newMixer = new $ mixer ( ) ; } elseif ( $ strength -> compare ( $ mixer :: getStrength ( ) ) == 1 ) { $ fallback = new $ mixer ( ) ; } } if ( is_null ( $ newMixer ) ) { if ( is_null ( $ fallback ) ) { throw new \ RuntimeException ( 'Could not find mixer' ) ; } return $ fallback ; } return $ newMixer ; }
Find a mixer based upon the requested strength

@param Strength $strength The strength mixer to find

@throws RuntimeException if a valid mixer cannot be found

@return Mixer The found mixer
Find a mixer based upon the requested strength