protected function checkToken() {
        //instantiate MultiOtp Wrapper
        $multiOtpWrapper = new MultiotpWrapper();
        
        //get the username
        $currentUserName = $this->getCurrentUsername();
        
        //assert that username is set
        if (!(\strlen((string) $currentUserName))) {
            throw new UserCredentialException('Cannot validate a TOTP token when username is not set!', 2106);
        }
        
        //assert that the token exists
        $tokenExists = $multiOtpWrapper->CheckTokenExists($currentUserName);
        
        if (!($tokenExists)) {
            throw new UserCredentialException('The TOTP token for the current user does not exist', 2107);
        }

        //username mapped to their token name
        $multiOtpWrapper->setToken($currentUserName);
        
        //validate the Token
        $oneTimeToken = $this->getOneTimeToken();
        $tokenCheckResult = $multiOtpWrapper->CheckToken($oneTimeToken);
        
        //The results are reversed
        //TODO: Add intepretation of MultiOtp return results here to enable exception handling
        if ($tokenCheckResult == 0) {
            return true;
        } else {
            return false;
        }
    }
protected function checkToken() {
        //instantiate MultiOtp Wrapper
        $multiOtpWrapper = new MultiotpWrapper();
        
        //get the username
        $currentUserName = $this->getCurrentUsername();
        
        //assert that username is set
        if (!(\strlen((string) $currentUserName))) {
            throw new UserCredentialException('Cannot validate a TOTP token when username is not set!', 2106);
        }
        
        //assert that the token exists
        $tokenExists = $multiOtpWrapper->CheckTokenExists($currentUserName);
        
        if (!($tokenExists)) {
            throw new UserCredentialException('The TOTP token for the current user does not exist', 2107);
        }

        //username mapped to their token name
        $multiOtpWrapper->setToken($currentUserName);
        
        //validate the Token
        $oneTimeToken = $this->getOneTimeToken();
        $tokenCheckResult = $multiOtpWrapper->CheckToken($oneTimeToken);
        
        //The results are reversed
        //TODO: Add intepretation of MultiOtp return results here to enable exception handling
        if ($tokenCheckResult == 0) {
            return true;
        } else {
            return false;
        }
    }
protected function checkToken ( ) { //instantiate MultiOtp Wrapper
 $ multiOtpWrapper = new MultiotpWrapper ( ) ; //get the username
 $ currentUserName = $ this -> getCurrentUsername ( ) ; //assert that username is set
 if ( ! ( \ strlen ( ( string ) $ currentUserName ) ) ) { throw new UserCredentialException ( 'Cannot validate a TOTP token when username is not set!' , 2106 ) ; } //assert that the token exists
 $ tokenExists = $ multiOtpWrapper -> CheckTokenExists ( $ currentUserName ) ; if ( ! ( $ tokenExists ) ) { throw new UserCredentialException ( 'The TOTP token for the current user does not exist' , 2107 ) ; } //username mapped to their token name
 $ multiOtpWrapper -> setToken ( $ currentUserName ) ; //validate the Token
 $ oneTimeToken = $ this -> getOneTimeToken ( ) ; $ tokenCheckResult = $ multiOtpWrapper -> CheckToken ( $ oneTimeToken ) ; //The results are reversed
 //TODO: Add intepretation of MultiOtp return results here to enable exception handling
 if ( $ tokenCheckResult == 0 ) { return true ; } else { return false ; } }
Verify a user token if it exists as part of the multi factor login process

Cyril Ogana <cogana@gmail.com> - 2016-07-05

@return boolean
@throws UserCredentialException
Verify a user token if it exists as part of the multi factor login process