3 declare(strict_types=1);
12 private $tokenStorage;
17 private $anonymousProvider;
24 $this->tokenStorage = $tokenStorage;
25 $this->anonymousProvider = $anonymousProvider;
33 $token = $this->anonymousProvider->refreshToken();
34 $this->storeToken($token);
44 $token = $this->tokenStorage->getAccessToken();
45 if (!is_null($token)) {
49 if ($this->tokenStorage->getRefreshToken()) {
53 $token = $this->anonymousProvider->getToken();
54 $this->storeToken($token);
59 private function storeToken(
Token $token): void
61 $this->tokenStorage->setAccessToken($token->
getValue());
63 $this->tokenStorage->setRefreshToken($token->getRefreshToken());