QBankApi.php
public function getTokens()
    {
        $tokens = ['accessToken' => null, 'refreshToken' => null];
        if ($this->oauth2Middleware instanceof OAuthMiddleware) {
            $tokens['accessToken'] = $this->oauth2Middleware->getAccessToken();
            $tokens['refreshToken'] = $this->oauth2Middleware->getRefreshToken();
        }
        if ($this->cache instanceof Cache && empty($tokens['accessToken']) && $this->cache->contains('oauth2accesstoken')) {
            $tokens['accessToken'] = unserialize($this->cache->fetch('oauth2accesstoken'));
        }
        if ($this->cache instanceof Cache && empty($tokens['accessToken']) && $this->cache->contains('oauth2refreshtoken')) {
            $tokens['refreshToken'] = unserialize($this->cache->fetch('oauth2refreshtoken'));
        }
        if (empty($tokens['accessToken'])) {
            $response = $this->getClient()->get('/');      // Trigger call to get a token. Don't care about the result.
            $tokens['accessToken'] = $this->oauth2Middleware->getAccessToken();
            $tokens['refreshToken'] = $this->oauth2Middleware->getRefreshToken();
        }

        return $tokens;
    }
public function getTokens()
    {
        $tokens = ['accessToken' => null, 'refreshToken' => null];
        if ($this->oauth2Middleware instanceof OAuthMiddleware) {
            $tokens['accessToken'] = $this->oauth2Middleware->getAccessToken();
            $tokens['refreshToken'] = $this->oauth2Middleware->getRefreshToken();
        }
        if ($this->cache instanceof Cache && empty($tokens['accessToken']) && $this->cache->contains('oauth2accesstoken')) {
            $tokens['accessToken'] = unserialize($this->cache->fetch('oauth2accesstoken'));
        }
        if ($this->cache instanceof Cache && empty($tokens['accessToken']) && $this->cache->contains('oauth2refreshtoken')) {
            $tokens['refreshToken'] = unserialize($this->cache->fetch('oauth2refreshtoken'));
        }
        if (empty($tokens['accessToken'])) {
            $response = $this->getClient()->get('/');      // Trigger call to get a token. Don't care about the result.
            $tokens['accessToken'] = $this->oauth2Middleware->getAccessToken();
            $tokens['refreshToken'] = $this->oauth2Middleware->getRefreshToken();
        }

        return $tokens;
    }
public function getTokens ( ) { $ tokens = [ 'accessToken' => null , 'refreshToken' => null ] ; if ( $ this -> oauth2Middleware instanceof OAuthMiddleware ) { $ tokens [ 'accessToken' ] = $ this -> oauth2Middleware -> getAccessToken ( ) ; $ tokens [ 'refreshToken' ] = $ this -> oauth2Middleware -> getRefreshToken ( ) ; } if ( $ this -> cache instanceof Cache && empty ( $ tokens [ 'accessToken' ] ) && $ this -> cache -> contains ( 'oauth2accesstoken' ) ) { $ tokens [ 'accessToken' ] = unserialize ( $ this -> cache -> fetch ( 'oauth2accesstoken' ) ) ; } if ( $ this -> cache instanceof Cache && empty ( $ tokens [ 'accessToken' ] ) && $ this -> cache -> contains ( 'oauth2refreshtoken' ) ) { $ tokens [ 'refreshToken' ] = unserialize ( $ this -> cache -> fetch ( 'oauth2refreshtoken' ) ) ; } if ( empty ( $ tokens [ 'accessToken' ] ) ) { $ response = $ this -> getClient ( ) -> get ( '/' ) ; // Trigger call to get a token. Don't care about the result. $ tokens [ 'accessToken' ] = $ this -> oauth2Middleware -> getAccessToken ( ) ; $ tokens [ 'refreshToken' ] = $ this -> oauth2Middleware -> getRefreshToken ( ) ; } return $ tokens ; }
Gets the token used for authentication.

@return array ['accessToken' => AccessToken|null, 'refreshToken' => RefreshToken|null]
Gets the token used for authentication .