original_string: public function getTokenById($id)
      {
          if ($id)
          {
              $record = Oauth_TokenRecord::model()->findById($id);
  
              if ($record)
              {
                  $token = Oauth_TokenModel::populateModel($record);
  
                  // will refresh token if needed
  
                  try
                  {
                      if($this->_refreshToken($token))
                      {
                          // save refreshed token
                          $this->saveToken($token);
                      }
                  }
                  catch(\Exception $e)
                  {
                      OauthPlugin::log("OAuth.Debug - Couldn't refresh token\r\n".$e->getMessage().'\r\n'.$e->getTraceAsString(), LogLevel::Error, true);
                  }
  
                  return $token;
              }
          }
      }
code: public function getTokenById($id)
      {
          if ($id)
          {
              $record = Oauth_TokenRecord::model()->findById($id);
  
              if ($record)
              {
                  $token = Oauth_TokenModel::populateModel($record);
  
                  // will refresh token if needed
  
                  try
                  {
                      if($this->_refreshToken($token))
                      {
                          // save refreshed token
                          $this->saveToken($token);
                      }
                  }
                  catch(\Exception $e)
                  {
                      OauthPlugin::log("OAuth.Debug - Couldn't refresh token\r\n".$e->getMessage().'\r\n'.$e->getTraceAsString(), LogLevel::Error, true);
                  }
  
                  return $token;
              }
          }
      }
code_tokens: public function getTokenById ( $ id ) { if ( $ id ) { $ record = Oauth_TokenRecord :: model ( ) -> findById ( $ id ) ; if ( $ record ) { $ token = Oauth_TokenModel :: populateModel ( $ record ) ; // will refresh token if needed try { if ( $ this -> _refreshToken ( $ token ) ) { // save refreshed token $ this -> saveToken ( $ token ) ; } } catch ( \ Exception $ e ) { OauthPlugin :: log ( "OAuth.Debug - Couldn't refresh token\r\n" . $ e -> getMessage ( ) . '\r\n' . $ e -> getTraceAsString ( ) , LogLevel :: Error , true ) ; } return $ token ; } } }
docstring: Get token by ID
docstring_tokens: Get token by ID