Wikibase
MediaWiki Wikibase extension
Loading...
Searching...
No Matches
Wikibase\Lib\Formatters\PlaintextTimeFormatter Class Reference

A value formatter that formats a time value as plain text, including the calendar model if necessary or specified by the formatter options. More...

+ Inheritance diagram for Wikibase\Lib\Formatters\PlaintextTimeFormatter:
+ Collaboration diagram for Wikibase\Lib\Formatters\PlaintextTimeFormatter:

Public Member Functions

 __construct (?FormatterOptions $options, ValueFormatter $dateTimeFormatter, ShowCalendarModelDecider $decider)
 
 format ( $value)
 

Private Member Functions

 formatCalendarName (string $calendarModel)
 

Private Attributes

const CALENDAR_KEYS
 
FormatterOptions $options
 
ValueFormatter $dateTimeFormatter
 
ShowCalendarModelDecider $decider
 

Detailed Description

A value formatter that formats a time value as plain text, including the calendar model if necessary or specified by the formatter options.

The calendar model is added in parentheses when needed, as determined by the ShowCalendarModelDecider (taking the options into account).

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Lib\Formatters\PlaintextTimeFormatter::__construct ( ?FormatterOptions $options,
ValueFormatter $dateTimeFormatter,
ShowCalendarModelDecider $decider )
Parameters
FormatterOptions | null$options
ValueFormatter$dateTimeFormatterA value formatter that accepts TimeValue objects and returns the formatted date and time, but not the calendar model.
ShowCalendarModelDecider$decider

Member Function Documentation

◆ format()

Wikibase\Lib\Formatters\PlaintextTimeFormatter::format ( $value)

◆ formatCalendarName()

Wikibase\Lib\Formatters\PlaintextTimeFormatter::formatCalendarName ( string $calendarModel)
private

Member Data Documentation

◆ $dateTimeFormatter

ValueFormatter Wikibase\Lib\Formatters\PlaintextTimeFormatter::$dateTimeFormatter
private

◆ $decider

ShowCalendarModelDecider Wikibase\Lib\Formatters\PlaintextTimeFormatter::$decider
private

◆ $options

FormatterOptions Wikibase\Lib\Formatters\PlaintextTimeFormatter::$options
private

◆ CALENDAR_KEYS

const Wikibase\Lib\Formatters\PlaintextTimeFormatter::CALENDAR_KEYS
private
Initial value:
= [
TimeValue::CALENDAR_GREGORIAN => 'wikibase-time-calendar-gregorian',
TimeValue::CALENDAR_JULIAN => 'wikibase-time-calendar-julian',
]

The documentation for this class was generated from the following file: