/** * Logs out current user. */ public function logout() { if ($this->isAuthenticated()) { $this->service->deleteTokenForUser($this->getUserId()); $this->token = null; } }