| Total Complexity | 4 |
| Total Lines | 35 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 10 | final class TokenStorageScope implements TokenStorageInterface, SingletonInterface |
||
| 11 | { |
||
| 12 | public function __construct( |
||
| 13 | private readonly TokenStorageInterface $tokenStorage |
||
| 14 | ) { |
||
| 15 | } |
||
| 16 | |||
| 17 | /** |
||
| 18 | * Load token by id, must return null if token not found. |
||
| 19 | * |
||
| 20 | * @throws TokenStorageException |
||
| 21 | */ |
||
| 22 | public function load(string $id): ?TokenInterface |
||
| 23 | { |
||
| 24 | 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 | 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 | public function delete(TokenInterface $token): void |
||
| 45 | } |
||
| 46 | } |
||
| 47 |