PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 28.4
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v28.4
28.5 28.4 28.3 28.2 28.1 28.0 27.9 27.8 27.7 27.6 27.5 trunk 18.0 18.1 18.2 18.3 18.4 18.4.1 18.5 18.5.1 18.6 18.7 18.8 18.9 19.0 All 129 releases
wordpress-seo / src / myyoast-client / application / ports / token-storage-interface.php

token-storage-interface.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI 28.4, at src/myyoast-client/application/ports/token-storage-interface.php

71 lines 2.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 // phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong -- Needed in the folder structure.
3
4 namespace Yoast\WP\SEO\MyYoast_Client\Application\Ports;
5
6 use Yoast\WP\SEO\MyYoast_Client\Application\Exceptions\Token_Storage_Exception;
7 use Yoast\WP\SEO\MyYoast_Client\Domain\Resource_Indicator;
8 use Yoast\WP\SEO\MyYoast_Client\Domain\Token_Set;
9
10 /**
11 * Port for site-level token persistence.
12 *
13 * Tokens are bucketed by RFC 8707 resource indicator so a site can hold one
14 * token per resource server. The null bucket is the default resource.
15 */
16 interface Token_Storage_Interface {
17
18 /**
19 * Retrieves the stored token set for a resource bucket.
20 *
21 * @param Resource_Indicator $resource_indicator The resource indicator (use Resource_Indicator::default() for the default bucket).
22 *
23 * @return Token_Set|null The token set, or null if not stored.
24 */
25 public function get( Resource_Indicator $resource_indicator ): ?Token_Set;
26
27 /**
28 * Stores a token set. The resource bucket is derived from the token's own resource indicator.
29 *
30 * @param Token_Set $token_set The token set to store.
31 *
32 * @return void
33 *
34 * @throws Token_Storage_Exception If storage fails.
35 */
36 public function store( Token_Set $token_set ): void;
37
38 /**
39 * Deletes the stored token set for a resource bucket.
40 *
41 * @param Resource_Indicator $resource_indicator The resource indicator (use Resource_Indicator::default() for the default bucket).
42 *
43 * @return void
44 */
45 public function delete( Resource_Indicator $resource_indicator ): void;
46
47 /**
48 * Returns every stored token set across resource buckets.
49 *
50 * @return Token_Set[] The stored token sets.
51 */
52 public function get_all(): array;
53
54 /**
55 * Deletes every stored token set across resource buckets for the current issuer.
56 *
57 * @return void
58 */
59 public function delete_all(): void;
60
61 /**
62 * Deletes every stored token set across all issuers and resource buckets.
63 *
64 * Intended for full plugin cleanup on uninstall, where any token bucket
65 * for any issuer that this site ever connected to should be purged.
66 *
67 * @return void
68 */
69 public function delete_all_issuers(): void;
70 }
71