/** * Saves the keywords to the last searches in the database or session depending on the configuration. * * @param string $keywords * @throws \UnexpectedValueException */ public function addToLastSearches($keywords) { $mode = $this->configuration->getSearchLastSearchesMode(); switch ($mode) { case 'user': $this->storeKeywordsToSession($keywords); break; case 'global': $this->storeKeywordsToDatabase($keywords); break; default: throw new \UnexpectedValueException('Unknown mode for plugin.tx_solr.search.lastSearches.mode, valid modes are "user" or "global".', 1342456570); } }