src/Ant/ChateaClient/Service/Client/ChateaGratisAppClient.php
private function prepareAccessToken()
    {
        // if not exits data in the store
        if(!$this->store->getPersistentData('token_expires_at')){
            return $this->getAccessTokenWithClientCredentials();
         // if access token expires.
        }else if($this->store->getPersistentData('token_expires_at') < time()){
            try{
                return $this->getAccessTokenWithRefreshToken();    
            }catch(AuthenticationException $e){
                return $this->getAccessTokenWithClientCredentials();
            }
        }else{
            return $this->store->getPersistentData('access_token');
        }
    }
private function prepareAccessToken()
    {
        // if not exits data in the store
        if(!$this->store->getPersistentData('token_expires_at')){
            return $this->getAccessTokenWithClientCredentials();
         // if access token expires.
        }else if($this->store->getPersistentData('token_expires_at') < time()){
            try{
                return $this->getAccessTokenWithRefreshToken();    
            }catch(AuthenticationException $e){
                return $this->getAccessTokenWithClientCredentials();
            }
        }else{
            return $this->store->getPersistentData('access_token');
        }
    }
private function prepareAccessToken ( ) { // if not exits data in the store if ( ! $ this -> store -> getPersistentData ( 'token_expires_at' ) ) { return $ this -> getAccessTokenWithClientCredentials ( ) ; // if access token expires. } else if ( $ this -> store -> getPersistentData ( 'token_expires_at' ) < time ( ) ) { try { return $ this -> getAccessTokenWithRefreshToken ( ) ; } catch ( AuthenticationException $ e ) { return $ this -> getAccessTokenWithClientCredentials ( ) ; } } else { return $ this -> store -> getPersistentData ( 'access_token' ) ; } }
This retrieve the access token in store or in server

@return string the access token
This retrieve the access token in store or in server