/** * Retrieve a fallback/alternative RNG generator * * @return RandomLib\Generator */ public static function getAlternativeGenerator() { if (null !== static::$generator) { return static::$generator; } if (!class_exists('RandomLib\\Factory')) { throw new Exception\RuntimeException('The RandomLib fallback pseudorandom number generator (PRNG) ' . ' must be installed in the absence of the OpenSSL and ' . 'Mcrypt extensions'); } $factory = new RandomLib\Factory(); $factory->registerSource('HashTiming', 'Zend\\Math\\Source\\HashTiming'); static::$generator = $factory->getMediumStrengthGenerator(); return static::$generator; }
/** * Sets XML generator instance * * @param null|Generator\GeneratorInterface $generator * @return void */ public static function setGenerator(Generator\GeneratorInterface $generator = null) { static::$generator = $generator; }
/** * @param $strength * @return null */ public static function setStrength($strength) { $factory = new Factory(); static::$generator = $factory->getGenerator(new Strength($strength)); return static::generator(); }
function let(UuidGenerator $generator) { static::$generator = $generator; $this->beConstructedWith($generator); }