Yoast\WP\SEO\AI_Authorization\Application

Token_Manager::has_local_tokens │ public │ Yoast 1.0

Устарела с версии 28.4. Больше не поддерживается и может быть удалена. Рекомендуется заменить эту функцию на аналог.

Checks whether any JWT (access or refresh) is stored locally for the user.

Метод класса: Token_Manager{}

Хуков нет.

Возвращает

bool. 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.

Список изменений

Устарела с 28.4

Код Token_Manager::has_local_tokens() Yoast 28.9

public function has_local_tokens( int $user_id ): bool {
	\_deprecated_function( __METHOD__, 'Yoast SEO 28.4' );
	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;
	}
}