config = $config; $this->user = $user; } /** * @inheritDoc */ public function getName() : string { return Constants::REQUIREMENT_USE_WVUI_SEARCH; } /** * If A/B test is enabled check whether the user is logged in and bucketed. * Fallback to `VectorUseWvuiSearch` config value. * * @inheritDoc * @throws \ConfigException */ public function isMet() : bool { // Determine the search widget treatment to send to the user $shouldUseWvuiSearch = (bool)$this->config->get( Constants::CONFIG_KEY_USE_WVUI_SEARCH ); if ( (bool)$this->config->get( Constants::CONFIG_SEARCH_TREATMENT_AB_TEST ) && $this->user->isRegistered() ) { $shouldUseWvuiSearch = $this->user->getID() % 2 === 0; } return $shouldUseWvuiSearch; } }