/** * Sets a cache * * @param Zend_Cache_Core $cache Cache to set * @return void */ public static function setCache(Zend_Cache_Core $cache) { Data::setCache($cache); }
private static function _checkOptions(array $options = array()) { if (count($options) == 0) { return self::$_options; } foreach ($options as $name => $value) { $name = strtolower($name); if ($name !== 'locale') { if (gettype($value) === 'string') { $value = strtolower($value); } } switch ($name) { case 'number_format': if ($value == Format::STANDARD) { $locale = self::$_options['locale']; if (isset($options['locale'])) { $locale = $options['locale']; } $options['number_format'] = Data::getContent($locale, 'decimalnumber'); } else { if (gettype($value) !== 'string' and $value !== NULL) { throw new Exception("Unknown number format type '" . gettype($value) . "'. " . "Format '{$value}' must be a valid number format string."); } } break; case 'date_format': if ($value == Format::STANDARD) { $locale = self::$_options['locale']; if (isset($options['locale'])) { $locale = $options['locale']; } $options['date_format'] = Format::getDateFormat($locale); } else { if (gettype($value) !== 'string' and $value !== NULL) { throw new Exception("Unknown dateformat type '" . gettype($value) . "'. " . "Format '{$value}' must be a valid ISO or PHP date format string."); } else { if (isset($options['format_type']) === true and $options['format_type'] == 'php' or isset($options['format_type']) === false and self::$_options['format_type'] == 'php') { $options['date_format'] = Format::convertPhpToIsoFormat($value); } } } break; case 'format_type': if ($value != 'php' && $value != 'iso') { throw new Exception("Unknown date format type '{$value}'. Only 'iso' and 'php'" . " are supported."); } break; case 'fix_date': if ($value !== true && $value !== false) { throw new Exception("Enabling correction of dates must be either true or false" . "(fix_date='{$value}')."); } break; case 'locale': $options['locale'] = Locale::findLocale($value); break; case 'cache': if ($value instanceof Zend_Cache_Core) { Data::setCache($value); } break; case 'disablecache': Data::disableCache($value); break; case 'precision': if ($value === NULL) { $value = -1; } if ($value < -1 || $value > 30) { throw new Exception("'{$value}' precision is not a whole number less than 30."); } break; default: throw new Exception("Unknown option: '{$name}' = '{$value}'"); break; } } return $options; }