You are here

public static function AccessToken::defaultExpiration in Access unpublished 8

1 call to AccessToken::defaultExpiration()
AccessTokenController::renew in src/Controller/AccessTokenController.php
Renews an access token.

File

src/Entity/AccessToken.php, line 220

Class

AccessToken
Defines the Access token entity.

Namespace

Drupal\access_unpublished\Entity

Code

public static function defaultExpiration() {
  $defaultDuration = \Drupal::config('access_unpublished.settings')
    ->get('duration') ?? static::DEFAULT_EXPIRATION_PERIOD;
  if ($defaultDuration === -1) {
    return [
      $defaultDuration,
    ];
  }
  else {
    return [
      \Drupal::time()
        ->getRequestTime() + $defaultDuration,
    ];
  }
}