Hackzilla\PasswordGenerator\Generator\HybridPasswordGenerator::generatePassword PHP Метод

generatePassword() публичный Метод

Generate one password based on options.
public generatePassword ( ) : string
Результат string password
    public function generatePassword()
    {
        $characterList = $this->getCharacterList()->getCharacters();
        $characters = \strlen($characterList);
        $password = '';
        $segmentCount = $this->getSegmentCount();
        $segmentLength = $this->getSegmentLength();
        for ($i = 0; $i < $segmentCount; ++$i) {
            if ($password) {
                $password .= $this->getSegmentSeparator();
            }
            for ($j = 0; $j < $segmentLength; ++$j) {
                $password .= $characterList[$this->randomInteger(0, $characters - 1)];
            }
        }
        return $password;
    }