public function __construct(SecureRandomInterface $rng, $set = self::ALL) { parent::__construct($rng); $chars = ""; if (is_int($set)) { if ($set & self::ALPHA_LOWER) { $chars .= "abcdefghijklmnopqrstuvwxyz"; } if ($set & self::ALPHA_UPPER) { $chars .= "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; } if ($set & self::NUMBER) { $chars .= "0123456789"; } if ($set & self::SPECIALS) { $chars .= ".-+=_,!@\$#*%<>[]{}"; } } else { if (is_string($set)) { $chars = $set; } } if (count($chars) < 1) { throw new LogicException("Too few characters to use for generating passwords"); } $this->chars = $chars; }
public function __construct(SecureRandomInterface $rng, KernelInterface $kernel, array $languages) { parent::__construct($rng); $this->resource = $kernel->locateResource('@TweedeGolfGeneratorBundle/Resources/wordlists'); $this->setLanguages($languages); $this->setSeparator(' '); }
public function __construct(SecureRandomInterface $rng, $separator = '-') { parent::__construct($rng); $this->setSeparator($separator); $this->grams = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'ch', 'gh', 'ph', 'rh', 'sh', 'th', 'wh', 'qu', 'ck']; $this->vowelGrams = ['a', 'e', 'i', 'o', 'u', 'y']; $this->generateGramRules(); $this->generateDigramRules(); }