You are here

protected function RestfulTokenAuthController::getExpireTime in RESTful 7.2

Return the expiration time.

Return value

int Timestamp with the expiration time.

Throws

ServerConfigurationException

1 call to RestfulTokenAuthController::getExpireTime()
RestfulTokenAuthController::generateAccessToken in modules/restful_token_auth/src/Entity/RestfulTokenAuthController.php
Create a new access_token entity with a referenced refresh_token.

File

modules/restful_token_auth/src/Entity/RestfulTokenAuthController.php, line 95
Contains Drupal\restful_token_auth\Entity\RestfulTokenAuthController.

Class

RestfulTokenAuthController

Namespace

Drupal\restful_token_auth\Entity

Code

protected function getExpireTime() {
  $now = new \DateTime();
  try {
    $expiration = $now
      ->add(new \DateInterval(variable_get('restful_token_auth_expiration_period', 'P1D')));
  } catch (\Exception $e) {
    throw new ServerConfigurationException('Invalid DateInterval format provided.');
  }
  return $expiration
    ->format('U');
}