Esempio n. 1
0
 /**
  * Returns localized title for a holiday
  *
  * @param string $internalName internal name for holiday
  * @param string $locale       locale setting to be used by this method
  *
  * @access   public
  * @return   string  title on success, otherwise a PEAR_Error object
  * @throws   object PEAR_Error DATE_HOLIDAYS_INVALID_INTERNAL_NAME
  * @throws   object PEAR_Error DATE_HOLIDAYS_TITLE_UNAVAILABLE
  */
 function getHolidayTitle($internalName, $locale = null)
 {
     if (!in_array($internalName, $this->_internalNames)) {
         $msg = 'Invalid internal name: ' . $internalName;
         return Date_Holidays::raiseError(DATE_HOLIDAYS_INVALID_INTERNAL_NAME, $msg);
     }
     if (is_null($locale)) {
         $locale = $this->_findBestLocale($this->_locale);
     } else {
         $locale = $this->_findBestLocale($locale);
     }
     if (!isset($this->_titles[$locale][$internalName])) {
         if (Date_Holidays::staticGetProperty('DIE_ON_MISSING_LOCALE')) {
             $err = DATE_HOLIDAYS_TITLE_UNAVAILABLE;
             $msg = 'The internal name (' . $internalName . ') ' . 'for the holiday was correct but no ' . 'localized title could be found';
             return Date_Holidays::raiseError($err, $msg);
         }
     }
     if (isset($this->_titles[$locale][$internalName])) {
         return $this->_titles[$locale][$internalName];
     } else {
         return $this->_titles['C'][$internalName];
     }
 }