Yoast\WP\SEO\AI_Authorization\Application
Token_Manager::has_local_tokens
Checks whether any JWT (access or refresh) is stored locally for the user.
Метод класса: Token_Manager{}
Хуков нет.
Возвращает
true|false. Whether a locally stored JWT exists.
Использование
$Token_Manager = new Token_Manager(); $Token_Manager->has_local_tokens( $user_id ): bool;
- $user_id(int) (обязательный)
- The user ID.
Код Token_Manager::has_local_tokens() Token Manager::has local tokens Yoast 28.3
public function has_local_tokens( int $user_id ): bool {
try {
$this->access_token_repository->get_token( $user_id );
return true;
} catch ( RuntimeException $e ) { // phpcs:ignore Generic.CodeAnalysis.EmptyStatement.DetectedCatch -- Reason: Ignored on purpose.
// No access token; fall through to the refresh token check.
}
try {
$this->refresh_token_repository->get_token( $user_id );
return true;
} catch ( RuntimeException $e ) {
return false;
}
}