scopeConfig = $scopeConfig; $this->path = $path; $this->scopeType = $scopeType; $this->scopeCode = $scopeCode; $this->engines = $engines; $this->logger = $logger; $this->defaultEngine = $defaultEngine; } /** * Returns Current Search Engine * * It returns string identifier of Search Engine that is currently chosen in configuration * * @return string * @since 100.1.0 */ public function getCurrentSearchEngine() { $engine = $this->scopeConfig->getValue( $this->path, $this->scopeType, $this->scopeCode ); if (in_array($engine, $this->engines)) { return $engine; } else { //get default engine from default scope if ($this->defaultEngine && in_array($this->defaultEngine, $this->engines)) { $this->logger->error( $engine . ' search engine doesn\'t exist. Falling back to ' . $this->defaultEngine ); } else { $this->logger->error( 'Default search engine is not configured, fallback is not possible' ); } return $this->defaultEngine; } } }