Yoast\WP\SEO\MyYoast_Client\Application\Ports

Token_Storage_Interface{}interfaceYoast 1.0

Port for site-level token persistence.

Tokens are bucketed by RFC 8707 resource indicator so a site can hold one token per resource server. The null bucket is the default resource.

Хуков нет.

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

$Token_Storage_Interface = new Token_Storage_Interface();
// use class methods

Методы

  1. public delete( Resource_Indicator $resource_indicator )
  2. public delete_all()
  3. public delete_all_issuers()
  4. public get( Resource_Indicator $resource_indicator )
  5. public get_all()
  6. public store( Token_Set $token_set )

Код Token_Storage_Interface{} Yoast 28.3

interface Token_Storage_Interface {

	/**
	 * Retrieves the stored token set for a resource bucket.
	 *
	 * @param Resource_Indicator $resource_indicator The resource indicator (use Resource_Indicator::default() for the default bucket).
	 *
	 * @return Token_Set|null The token set, or null if not stored.
	 */
	public function get( Resource_Indicator $resource_indicator ): ?Token_Set;

	/**
	 * Stores a token set. The resource bucket is derived from the token's own resource indicator.
	 *
	 * @param Token_Set $token_set The token set to store.
	 *
	 * @return void
	 *
	 * @throws Token_Storage_Exception If storage fails.
	 */
	public function store( Token_Set $token_set ): void;

	/**
	 * Deletes the stored token set for a resource bucket.
	 *
	 * @param Resource_Indicator $resource_indicator The resource indicator (use Resource_Indicator::default() for the default bucket).
	 *
	 * @return void
	 */
	public function delete( Resource_Indicator $resource_indicator ): void;

	/**
	 * Returns every stored token set across resource buckets.
	 *
	 * @return Token_Set[] The stored token sets.
	 */
	public function get_all(): array;

	/**
	 * Deletes every stored token set across resource buckets for the current issuer.
	 *
	 * @return void
	 */
	public function delete_all(): void;

	/**
	 * Deletes every stored token set across all issuers and resource buckets.
	 *
	 * Intended for full plugin cleanup on uninstall, where any token bucket
	 * for any issuer that this site ever connected to should be purged.
	 *
	 * @return void
	 */
	public function delete_all_issuers(): void;
}