tokenStorage = $tokenStorage; $this->defaultTheme = $defaultTheme; $this->themes = $themes; } public function setUserAgent($userAgent) { } /** * This should return the active theme for the logged in user. * * Default theme for: * - anonymous user * - user without a config (shouldn't happen ..) * * @return string */ public function getType() { $token = $this->tokenStorage->getToken(); if (null === $token) { return $this->defaultTheme; } $user = $token->getUser(); if (!$user instanceof User) { return $this->defaultTheme; } $config = $user->getConfig(); if (!$config) { return $this->defaultTheme; } if (!\in_array($config->getTheme(), $this->themes, true)) { return $this->defaultTheme; } return $config->getTheme(); } }