tokens = array(); } /** * {@inheritDoc} */ public function retrieveAccessToken($service) { if ($this->hasAccessToken($service)) { return $this->tokens[$service]; } throw new TokenNotFoundException('Token not stored'); } /** * {@inheritDoc} */ public function storeAccessToken($service, TokenInterface $token) { $this->tokens[$service] = $token; // allow chaining return $this; } /** * {@inheritDoc} */ public function hasAccessToken($service) { return isset($this->tokens[$service]) && $this->tokens[$service] instanceof TokenInterface; } /** * {@inheritDoc} */ public function clearToken($service) { if (array_key_exists($service, $this->tokens)) { unset($this->tokens[$service]); } // allow chaining return $this; } /** * {@inheritDoc} */ public function clearAllTokens() { $this->tokens = array(); // allow chaining return $this; } }