db = $db; $this->locale = $locale; } public function getRegionalizedText($name) { if (array_key_exists($name,$this->cachedTexts)) { return $this->cachedTexts[$name]; } $stmt = $this->db->prepare(static::REGIONALIZED_TEXT_QUERY); $stmt->bindValue(':text_code',$name,PDO::PARAM_STR); $stmt->bindValue(':text_locale',$this->locale,PDO::PARAM_STR); $stmt->execute(); $textRow = $stmt->fetch(PDO::FETCH_ASSOC); if (is_array($textRow) && array_key_exists('text',$textRow)) { $this->cachedTexts[$name] = $textRow['text']; } else { $this->cachedTexts[$name] = $name; } return $this->cachedTexts[$name]; } }