/
githubmirror
/
ydb-php-sdk
Обзор
Документация
Войти
/
githubmirror
/
ydb-php-sdk
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
v1.5.4
src/Auth/Auth.php
41 строка
899 B
Ilya Kharev
Added credentials authentication
03 май 2023, 11:14
03 май 2023, 11:14
e4a5458
Код
Авторство
О чём код?
<?php namespace YdbPlatform\Ydb\Auth; use DateTime; use YdbPlatform\Ydb\Iam; abstract class Auth { public abstract function getTokenInfo(): TokenInfo; public abstract function getName(): string; protected $logger; public function logger(){ return $this->logger; } public function setLogger($logger){ $this->logger = $logger; } /** * @param string $expiresAt * @return int */ protected function convertExpiresAt($expiresAt) { if (is_int($expiresAt)) { return $expiresAt; } $time = time() + 60 * 60 * Iam::DEFAULT_TOKEN_EXPIRES_AT; if (preg_match('/^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2})(?:\.\d+)?(.*)$/', $expiresAt, $matches)) { $time = new DateTime($matches[1] . $matches[2]); $time = (int)$time->format('U'); } return $time; } }