request = $request; $this->user = $user; $this->config = $config; } /** * Whether or not the legacy skin is being used. * * @return bool * @throws \ConfigException */ public function isLegacy() { return $this->getVersion() === Constants::SKIN_VERSION_LEGACY; } /** * The skin version as a string. E.g., `Constants::SKIN_VERSION_LEGACY`, * `Constants::SKIN_VERSION_LATEST`, or maybe 'beta'. Note: it's likely someone will put arbitrary * strings in the query parameter which means this function returns those strings as is. * * @return string * @throws \ConfigException */ public function getVersion() { // Obtain the skin version from the `useskinversion` URL query parameter override, the user // preference, or the configured default. return (string)$this->request->getVal( Constants::QUERY_PARAM_SKIN_VERSION, $this->user->getOption( Constants::PREF_KEY_SKIN_VERSION, $this->config->get( Constants::CONFIG_KEY_DEFAULT_SKIN_VERSION ) ) ); } }