You are here

public static function DrupalOAuthConsumer::fromResult in OAuth 1.0 7.3

Same name and namespace in other branches
  1. 6.3 includes/DrupalOAuthConsumer.inc \DrupalOAuthConsumer::fromResult()
  2. 7.4 includes/DrupalOAuthConsumer.inc \DrupalOAuthConsumer::fromResult()

Constructs a consumer from a db-result resource

Parameters

resource $res: A database result resource

Return value

DrupalOAuthConsumer The constructed consumer object or NULL if no rows could be read or construction failed

3 calls to DrupalOAuthConsumer::fromResult()
DrupalOAuthConsumer::loadById in includes/DrupalOAuthConsumer.inc
Gets a provider consumer with the specified id
DrupalOAuthConsumer::loadProviderByKey in includes/DrupalOAuthConsumer.inc
Gets a provider consumer with the specified key
oauth_common_user_consumers in ./oauth_common.inc
Return information about consumers related to a user.

File

includes/DrupalOAuthConsumer.inc, line 222

Class

DrupalOAuthConsumer

Code

public static function fromResult($res) {

  //TODO: Ensure this works with old inputs?
  if ($data = $res
    ->fetchAssoc()) {
    if (!empty($data['configuration'])) {
      $data['configuration'] = unserialize($data['configuration']);
    }
    $data['in_database'] = TRUE;
    return new DrupalOAuthConsumer($data['consumer_key'], $data['secret'], $data);
  }
  return NULL;
}