This repository was archived by the owner on Jun 25, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +51
-4
lines changed Expand file tree Collapse file tree 4 files changed +51
-4
lines changed Original file line number Diff line number Diff line change @@ -45,4 +45,9 @@ public function deleteToken(TokenUUID $tokenUUID);
45
45
* @return Token[]
46
46
*/
47
47
public function getTokens (): array ;
48
+
49
+ /**
50
+ * Purge tokens.
51
+ */
52
+ public function deleteTokens ();
48
53
}
Original file line number Diff line number Diff line change @@ -73,11 +73,11 @@ public function findRepository(string $appName): ? AppRepository
73
73
}
74
74
75
75
/**
76
- * Get configuration
76
+ * Get configuration.
77
77
*
78
78
* @return array
79
79
*/
80
- public function getConfiguration () : array
80
+ public function getConfiguration (): array
81
81
{
82
82
return $ this ->configuration ;
83
83
}
Original file line number Diff line number Diff line change @@ -78,7 +78,7 @@ public function getTokens(): array
78
78
$ response = $ this
79
79
->httpClient
80
80
->get (
81
- '/token ' ,
81
+ '/tokens ' ,
82
82
'get ' ,
83
83
Http::getQueryValues ($ this )
84
84
);
@@ -89,4 +89,20 @@ public function getTokens(): array
89
89
return Token::createFromArray ($ token );
90
90
}, $ response ['body ' ]);
91
91
}
92
+
93
+ /**
94
+ * Delete all tokens.
95
+ */
96
+ public function deleteTokens ()
97
+ {
98
+ $ response = $ this
99
+ ->httpClient
100
+ ->get (
101
+ '/tokens ' ,
102
+ 'delete ' ,
103
+ Http::getQueryValues ($ this )
104
+ );
105
+
106
+ $ this ->throwTransportableExceptionIfNeeded ($ response );
107
+ }
92
108
}
Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ private function getIndexKey(): string
42
42
{
43
43
return $ this
44
44
->getRepositoryReference ()
45
- ->compose ();
45
+ ->getAppId ();
46
46
}
47
47
48
48
/**
@@ -72,4 +72,30 @@ public function deleteToken(TokenUUID $tokenUUID)
72
72
73
73
unset($ this ->tokens [$ this ->getIndexKey ()][$ tokenUUID ->composeUUID ()]);
74
74
}
75
+
76
+ /**
77
+ * Get tokens.
78
+ *
79
+ * @return Token[]
80
+ */
81
+ public function getTokens (): array
82
+ {
83
+ if (!array_key_exists ($ this ->getIndexKey (), $ this ->tokens )) {
84
+ throw ResourceNotAvailableException::indexNotAvailable ('Index not available in InMemoryRepository ' );
85
+ }
86
+
87
+ return $ this ->tokens [$ this ->getIndexKey ()];
88
+ }
89
+
90
+ /**
91
+ * Delete all tokens.
92
+ */
93
+ public function deleteTokens ()
94
+ {
95
+ if (!array_key_exists ($ this ->getIndexKey (), $ this ->tokens )) {
96
+ throw ResourceNotAvailableException::indexNotAvailable ('Index not available in InMemoryRepository ' );
97
+ }
98
+
99
+ $ this ->tokens [$ this ->getIndexKey ()] = [];
100
+ }
75
101
}
You can’t perform that action at this time.
0 commit comments