You are here

protected function LockrAdminController::extractExpires in Lockr 4.x

Returns a two element array of type and expires.

2 calls to LockrAdminController::extractExpires()
LockrAdminController::getStatus in src/Controller/LockrAdminController.php
Renders the Lockr status table.
LockrAdminController::overview in src/Controller/LockrAdminController.php
Renders the Lockr status page.

File

src/Controller/LockrAdminController.php, line 309

Class

LockrAdminController
Controller for the Lockr admin status and configuration page.

Namespace

Drupal\lockr\Controller

Code

protected function extractExpires(array $info) {
  $type = $info['auth']['__typename'] ?? '';
  $expires = NULL;
  switch ($type) {
    case 'LockrCert':
      if (isset($info['auth']['expires'])) {
        $expires_text = $info['auth']['expires'];
        try {
          $expires = DateTime::createFromFormat(DateTime::RFC3339, $expires_text) ?: NULL;
        } catch (\Exception $e) {
        }
      }
  }
  return [
    'type' => $type,
    'expires' => $expires,
  ];
}