/** * Getting a language analyzer class instance, ensuring one instance per analyzer * @param string $analyzerName The wanted analyzer name * @param \SCQAT\LanguageAbstract $language The language class instance * @return \SCQAT\AnalyzerAbstract The analyzer class instance */ private function getAnalyzer($analyzerName, \SCQAT\LanguageAbstract $language) { $languageName = $language->getName(); // Make a new instance if not already made if (empty($this->analyzersInstances[$languageName][$analyzerName])) { $className = "\\SCQAT\\Language\\" . $languageName . "\\Analyzer\\" . $analyzerName; // Do ensure $className is an analyzer class if (!is_subclass_of($className, '\\SCQAT\\AnalyzerAbstract')) { return false; } $this->analyzersInstances[$languageName][$analyzerName] = new $className($this->context, $language); } return $this->analyzersInstances[$languageName][$analyzerName]; }
/** * Get the name of the language of this analyzer (its language class name) * @return string The analyzer language name */ public function getLanguageName() { return $this->language->getName(); }