public function findValidOTP(
        $secret,
        $key,
        $window,
        $startingTimestamp,
        $timestamp,
        $oldTimestamp = Constants::ARGUMENT_NOT_SET
    ) {
        for (
            ;
            $startingTimestamp <= $timestamp + $this->getWindow($window);
            $startingTimestamp++
        ) {
            if (
                hash_equals($this->oathHotp($secret, $startingTimestamp), $key)
            ) {
                return $oldTimestamp === Constants::ARGUMENT_NOT_SET
                    ? true
                    : $startingTimestamp;
            }
        }

        return false;
    }
public function findValidOTP(
        $secret,
        $key,
        $window,
        $startingTimestamp,
        $timestamp,
        $oldTimestamp = Constants::ARGUMENT_NOT_SET
    ) {
        for (
            ;
            $startingTimestamp <= $timestamp + $this->getWindow($window);
            $startingTimestamp++
        ) {
            if (
                hash_equals($this->oathHotp($secret, $startingTimestamp), $key)
            ) {
                return $oldTimestamp === Constants::ARGUMENT_NOT_SET
                    ? true
                    : $startingTimestamp;
            }
        }

        return false;
    }
public function findValidOTP ( $ secret , $ key , $ window , $ startingTimestamp , $ timestamp , $ oldTimestamp = Constants :: ARGUMENT_NOT_SET ) { for ( ; $ startingTimestamp <= $ timestamp + $ this -> getWindow ( $ window ) ; $ startingTimestamp ++ ) { if ( hash_equals ( $ this -> oathHotp ( $ secret , $ startingTimestamp ) , $ key ) ) { return $ oldTimestamp === Constants :: ARGUMENT_NOT_SET ? true : $ startingTimestamp ; } } return false ; }
Find a valid One Time Password.

@param $secret
@param $key
@param $window
@param $startingTimestamp
@param $timestamp
@param string $oldTimestamp

@throws \PragmaRX\Google2FA\Exceptions\SecretKeyTooShortException
@throws \PragmaRX\Google2FA\Exceptions\InvalidCharactersException
@throws \PragmaRX\Google2FA\Exceptions\IncompatibleWithGoogleAuthenticatorException

@return bool
Find a valid One Time Password .