Total Complexity | 4 |
Total Lines | 35 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
10 | final class TokenStorageScope implements TokenStorageInterface, SingletonInterface |
||
11 | { |
||
12 | 68 | public function __construct( |
|
13 | private readonly TokenStorageInterface $tokenStorage |
||
14 | ) { |
||
15 | 68 | } |
|
16 | |||
17 | /** |
||
18 | * Load token by id, must return null if token not found. |
||
19 | * |
||
20 | * @throws TokenStorageException |
||
21 | */ |
||
22 | 1 | public function load(string $id): ?TokenInterface |
|
23 | { |
||
24 | 1 | return $this->tokenStorage->load($id); |
|
25 | } |
||
26 | |||
27 | /** |
||
28 | * Create token based on the payload provided by actor provider. |
||
29 | * |
||
30 | * @throws TokenStorageException |
||
31 | */ |
||
32 | 1 | public function create(array $payload, \DateTimeInterface $expiresAt = null): TokenInterface |
|
35 | } |
||
36 | |||
37 | /** |
||
38 | * Delete token from the persistent storage. |
||
39 | * |
||
40 | * @throws TokenStorageException |
||
41 | */ |
||
42 | 1 | public function delete(TokenInterface $token): void |
|
45 | } |
||
46 | } |
||
47 |