Hackzilla\PasswordGenerator\Generator\HumanPasswordGenerator::setWordList PHP Method

setWordList() public method

Set word list.
public setWordList ( string $filename )
$filename string
    public function setWordList($filename)
    {
        if (!is_string($filename)) {
            throw new \InvalidArgumentException('Expected string');
        } elseif (!file_exists($filename)) {
            throw new FileNotFoundException('File not found');
        }
        $this->setParameter(self::PARAMETER_DICTIONARY_FILE, $filename);
        $this->setParameter(self::PARAMETER_WORD_CACHE, null);
        return $this;
    }

Usage Example

Exemplo n.º 1
0
 /**
  * @Route("/generate/humanPassword", name="generateHumanPassword", condition="request.isXmlHttpRequest()")
  */
 public function generatePasswordAction(Request $request)
 {
     $generator = new ComputerPasswordGenerator();
     $generator->setUppercase()->setLowercase()->setNumbers()->setSymbols(false)->setAvoidSimilar()->setLength(12);
     $passwords = $generator->generatePasswords(5);
     $generator = new HumanPasswordGenerator();
     $generator->setWordList('/usr/share/dict/words')->setWordCount(3)->setWordSeparator('-');
     $passwords = array_merge($passwords, $generator->generatePasswords(5));
     //return new JsonResponse($passwords);
     return $this->render('AppBundle:Ajax:generatePasswords.html.twig', ['passwords' => $passwords]);
 }
All Usage Examples Of Hackzilla\PasswordGenerator\Generator\HumanPasswordGenerator::setWordList