You are here

private static function BearerTokenInfos::get_all in Backup and Migrate Dropbox 7.3

Returns all still valid bearer tokens.

Return value

object[] All still valid bearer tokens.

3 calls to BearerTokenInfos::get_all()
BearerTokenInfos::clear in ./backup_migrate_dropbox.dropbox_api.inc
Removes the bearer token for the current Dropbox destination.
BearerTokenInfos::get in ./backup_migrate_dropbox.dropbox_api.inc
Returns a bearer token for the current Dropbox destination
BearerTokenInfos::set in ./backup_migrate_dropbox.dropbox_api.inc
Stores a bearer token that was obtained from Dropbox.

File

./backup_migrate_dropbox.dropbox_api.inc, line 917

Class

BearerTokenInfos
Class BearerTokenInfos manages the bearer tokens.

Code

private static function get_all() {

  // Convert to keyed array on the upper level only.
  $bearer_tokens = (array) json_decode(variable_get('backup_migrate_dropbox_bearer_tokens', '{}'));
  $now = time();
  return array_filter($bearer_tokens, function ($bearer_token) use ($now) {
    return $bearer_token->expires >= $now;
  });
}