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 / user-token-storage-interface.php

user-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/user-token-storage-interface.php

76 lines 2.4 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 per-user token persistence.
12 *
13 * Tokens are bucketed by RFC 8707 resource indicator so a user can hold one
14 * token per resource server. The null bucket is the default resource.
15 */
16 interface User_Token_Storage_Interface {
17
18 /**
19 * Retrieves the stored token set for a user and resource bucket.
20 *
21 * @param int $user_id The user ID.
22 * @param Resource_Indicator $resource_indicator The resource indicator (use Resource_Indicator::default() for the default bucket).
23 *
24 * @return Token_Set|null The token set, or null if not stored.
25 */
26 public function get( int $user_id, Resource_Indicator $resource_indicator ): ?Token_Set;
27
28 /**
29 * Stores a token set for a user. The resource bucket is derived from the token's own resource indicator.
30 *
31 * @param int $user_id The user ID.
32 * @param Token_Set $token_set The token set to store.
33 *
34 * @return void
35 *
36 * @throws Token_Storage_Exception If storage fails.
37 */
38 public function store( int $user_id, Token_Set $token_set ): void;
39
40 /**
41 * Deletes the stored token set for a user and resource bucket.
42 *
43 * @param int $user_id The user ID.
44 * @param Resource_Indicator $resource_indicator The resource indicator (use Resource_Indicator::default() for the default bucket).
45 *
46 * @return void
47 */
48 public function delete( int $user_id, Resource_Indicator $resource_indicator ): void;
49
50 /**
51 * Returns every stored token set across resource buckets for a user.
52 *
53 * @param int $user_id The user ID.
54 *
55 * @return Token_Set[] The stored token sets.
56 */
57 public function get_all( int $user_id ): array;
58
59 /**
60 * Deletes every stored user token set across all users and resource buckets for the current issuer.
61 *
62 * @return void
63 */
64 public function delete_all(): void;
65
66 /**
67 * Deletes every stored user token set across all users, issuers, and resource buckets.
68 *
69 * Intended for full plugin cleanup on uninstall, where any token bucket
70 * for any issuer that this site ever connected to should be purged.
71 *
72 * @return void
73 */
74 public function delete_all_issuers(): void;
75 }
76