/** * Construct a new time-based one-time password validation result. * * @param string $type The result type. * @param boolean|null $drift The number of windows of clock drift, or null if unsuccessful. * * @throws Exception\InvalidMfaResultException If the supplied arguments constitute an invalid result. */ public function __construct($type, $drift = null) { if (static::VALID === $type && null === $drift || static::VALID !== $type && null !== $drift) { throw new Exception\InvalidMfaResultException(); } parent::__construct($type); $this->drift = $drift; }
/** * Construct a new counter-based one-time password validation result. * * @param string $type The result type. * @param integer|null $counter The new counter value, or null if the counter should not change. * * @throws Exception\InvalidMfaResultException If the supplied arguments constitute an invalid result. */ public function __construct($type, $counter = null) { if (static::VALID === $type && null === $counter || static::VALID !== $type && null !== $counter) { throw new Exception\InvalidMfaResultException(); } parent::__construct($type); $this->counter = $counter; }