/** * Construct a new mOTP driver. * * @param MfaValidatorInterface $validator The validator to use. * @param MfaSharedParametersGeneratorInterface|null $sharedParametersGenerator The shared parameters generator to use. */ public function __construct(MfaValidatorInterface $validator = null, MfaSharedParametersGeneratorInterface $sharedParametersGenerator = null) { if (null === $validator) { $valueGenerator = new Value\MotpValueGenerator(); $validator = new TimeBasedOtpValidator($valueGenerator); } if (null === $sharedParametersGenerator) { $sharedParametersGenerator = new Parameters\Generator\MotpSharedParametersGenerator(); } parent::__construct($validator, $sharedParametersGenerator); }
/** * Construct a new HOTP driver. * * @param MfaValidatorInterface $validator The validator to use. * @param MfaSharedParametersGeneratorInterface|null $sharedParametersGenerator The shared parameters generator to use. * @param InitializationUriFactoryInterface|null $initializationUriFactory The initialization URI factory to use, or null if not supported. */ public function __construct(MfaValidatorInterface $validator = null, MfaSharedParametersGeneratorInterface $sharedParametersGenerator = null, InitializationUriFactoryInterface $initializationUriFactory = null) { if (null === $validator) { $validator = new CounterBasedOtpValidator(new Value\HotpValueGenerator()); } if (null === $sharedParametersGenerator) { $sharedParametersGenerator = new CounterBasedOtpSharedParametersGenerator(); } if (null === $initializationUriFactory) { $initializationUriFactory = new GoogleAuthenticatorHotpUriFactory(); } parent::__construct($validator, $sharedParametersGenerator, $initializationUriFactory); }