/**
  * @param FormatterOptions|null $options
  */
 public function __construct(FormatterOptions $options = null)
 {
     parent::__construct($options);
     // TODO: What's a good default? Should this be locale dependant? Configurable?
     $this->defaultOption(GeoCoordinateFormatter::OPT_FORMAT, GeoCoordinateFormatter::TYPE_DMS);
     $this->coordinateFormatter = new GlobeCoordinateFormatter($this->options);
 }
 /**
  * @param NumberLocalizer|null $numberLocalizer
  * @param ValueFormatter|null $vocabularyUriFormatter
  * @param FormatterOptions|null $options
  */
 public function __construct(NumberLocalizer $numberLocalizer = null, ValueFormatter $vocabularyUriFormatter = null, FormatterOptions $options = null)
 {
     parent::__construct($options);
     $decimalFormatter = new DecimalFormatter($this->options, $numberLocalizer);
     $this->vocabularyUriFormatter = $vocabularyUriFormatter;
     $this->quantityFormatter = new QuantityFormatter($this->options, $decimalFormatter, $this->vocabularyUriFormatter);
     $this->numberFormatter = new QuantityFormatter(new FormatterOptions(array(QuantityFormatter::OPT_SHOW_UNCERTAINTY_MARGIN => false, QuantityFormatter::OPT_APPLY_ROUNDING => false)), $decimalFormatter, $this->vocabularyUriFormatter);
 }
Example #3
0
 /**
  * @since 0.6
  *
  * @param FormatterOptions|null $options
  * @param DecimalFormatter|null $decimalFormatter
  * @param ValueFormatter|null $vocabularyUriFormatter
  * @param string|null $quantityWithUnitFormat Format string with two placeholders, $1 for the
  * number and $2 for the unit. Warning, this must be under the control of the application, not
  * under the control of the user, because it allows HTML injections in subclasses that return
  * HTML.
  */
 public function __construct(FormatterOptions $options = null, DecimalFormatter $decimalFormatter = null, ValueFormatter $vocabularyUriFormatter = null, $quantityWithUnitFormat = null)
 {
     parent::__construct($options);
     $this->defaultOption(self::OPT_SHOW_UNCERTAINTY_MARGIN, true);
     $this->defaultOption(self::OPT_APPLY_ROUNDING, true);
     $this->defaultOption(self::OPT_APPLY_UNIT, true);
     $this->decimalFormatter = $decimalFormatter ?: new DecimalFormatter($this->options);
     $this->vocabularyUriFormatter = $vocabularyUriFormatter;
     $this->quantityWithUnitFormat = $quantityWithUnitFormat ?: '$1 $2';
     // plain composition should be sufficient
     $this->decimalMath = new DecimalMath();
 }
 /**
  * @since 0.1
  *
  * @param FormatterOptions $options
  */
 public function __construct(FormatterOptions $options)
 {
     parent::__construct($options);
     $this->defaultOption(self::OPT_NORTH_SYMBOL, 'N');
     $this->defaultOption(self::OPT_EAST_SYMBOL, 'E');
     $this->defaultOption(self::OPT_SOUTH_SYMBOL, 'S');
     $this->defaultOption(self::OPT_WEST_SYMBOL, 'W');
     $this->defaultOption(self::OPT_DEGREE_SYMBOL, '°');
     $this->defaultOption(self::OPT_MINUTE_SYMBOL, "'");
     $this->defaultOption(self::OPT_SECOND_SYMBOL, '"');
     $this->defaultOption(self::OPT_FORMAT, self::TYPE_FLOAT);
     $this->defaultOption(self::OPT_DIRECTIONAL, false);
     $this->defaultOption(self::OPT_SEPARATOR_SYMBOL, ',');
     $this->defaultOption(self::OPT_SPACING_LEVEL, array(self::OPT_SPACE_LATLONG, self::OPT_SPACE_DIRECTION, self::OPT_SPACE_COORDPARTS));
     $this->defaultOption(self::OPT_PRECISION, 0);
 }
 /**
  * @param FormatterOptions|null $options
  * @param ValueFormatter|null $timeFormatter A TimeValue formatter that outputs a single line of
  * HTML, suitable for headings.
  */
 public function __construct(FormatterOptions $options = null, ValueFormatter $timeFormatter = null)
 {
     parent::__construct($options);
     $this->timeFormatter = $timeFormatter ?: new HtmlTimeFormatter($this->options, new MwTimeIsoFormatter($this->options));
 }
 /**
  * @param FormatterOptions|null $options
  * @param ValueFormatter $dateTimeFormatter A value formatter that accepts TimeValue objects and
  *  returns the formatted date and time, but not the calendar model. Must return HTML.
  */
 public function __construct(FormatterOptions $options = null, ValueFormatter $dateTimeFormatter)
 {
     parent::__construct($options);
     $this->dateTimeFormatter = $dateTimeFormatter;
 }
 /**
  * @param FormatterOptions|null $options
  */
 public function __construct(FormatterOptions $options = null)
 {
     parent::__construct($options);
     $languageCode = $this->getOption(ValueFormatter::OPT_LANG);
     $this->language = Language::factory($languageCode);
 }
 /**
  * @param FormatterOptions|null $options
  */
 public function __construct(FormatterOptions $options = null)
 {
     parent::__construct($options);
     $this->defaultOption(self::OPT_MESSAGE_KEY, 'wikibase-undeserializable-value');
 }
 /**
  * @param FormatterOptions|null $options
  * @param LanguageNameLookup $languageNameLookup
  */
 public function __construct(FormatterOptions $options = null, LanguageNameLookup $languageNameLookup)
 {
     parent::__construct($options);
     $this->languageNameLookup = $languageNameLookup;
 }
Example #10
0
 /**
  * @see ValueFormatterBase::__construct
  *
  * @param FormatterOptions|null $options
  */
 public function __construct(FormatterOptions $options = null)
 {
     parent::__construct($options);
     $this->defaultOption(self::OPT_CALENDARNAMES, array());
     $this->defaultOption(self::OPT_TIME_ISO_FORMATTER, null);
 }
Example #11
0
 /**
  * @param FormatterOptions|null $options
  * @param NumberLocalizer|null $localizer
  */
 public function __construct(FormatterOptions $options = null, NumberLocalizer $localizer = null)
 {
     parent::__construct($options);
     $this->defaultOption(self::OPT_FORCE_SIGN, false);
     $this->localizer = $localizer ?: new BasicNumberLocalizer();
 }