Yoast\WP\SEO\MyYoast_Client\Infrastructure\OIDC

Discovery_Client::get_document │ public │ Yoast 1.0

Returns the validated discovery document.

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

Хуков нет.

Возвращает

Discovery_Document. The validated discovery document.

Использование

$Discovery_Client = new Discovery_Client();
$Discovery_Client->get_document(): Discovery_Document;

Код Discovery_Client::get_document() Yoast 28.9

public function get_document(): Discovery_Document {
	// Check in-memory cache: invalidate if issuer has changed.
	if ( $this->cached_document !== null ) {
		if ( $this->cached_document->get_issuer() === $this->issuer_config->get_issuer_url() ) {
			return $this->cached_document;
		}
		$this->cached_document = null;
	}

	$cached = \get_transient( $this->get_cache_key() );
	if ( \is_array( $cached ) && ! empty( $cached ) ) {
		try {
			$this->cached_document = new Discovery_Document( $cached );
			return $this->cached_document;
		} catch ( Discovery_Failed_Exception | Server_Capability_Exception $e ) {
			// Cached data is corrupted or no longer compatible — fetch fresh.
			$this->logger->info( 'Invalidating cached discovery document: {error}', [ 'error' => $e->getMessage() ] );
			\delete_transient( $this->get_cache_key() );
		}
	}

	return $this->fetch_and_cache();
}