Wikibase
MediaWiki Wikibase extension
Loading...
Searching...
No Matches
Wikibase\Repo\Parsers\DateFormatParser Class Reference

This parser is in essence the inverse operation of MediaWiki's Language::sprintfDate. More...

+ Inheritance diagram for Wikibase\Repo\Parsers\DateFormatParser:
+ Collaboration diagram for Wikibase\Repo\Parsers\DateFormatParser:

Public Member Functions

 __construct (ParserOptions $options=null)
 

Public Attributes

const OPT_DATE_FORMAT = 'dateFormat'
 
const OPT_DIGIT_TRANSFORM_TABLE = 'digitTransformTable'
 Option for unlocalizing non-canonical digits.
 
const OPT_MONTH_NAMES = 'monthNames'
 Option for localized month names.
 
const OPT_PRECISION = 'precision'
 Option to override the precision auto-detection and set a specific precision.
 

Protected Member Functions

 stringParse ( $value)
 

Private Member Functions

 parseDateFormat ( $format)
 
 getNumberPattern ()
 
 getMonthNamesPattern ()
 
 parseDate ( $input)
 
 findMonthMatch ( $matches)
 
 parseFormattedNumber ( $number)
 
 getDateFormat ()
 
 getDigitTransformTable ()
 
 getMonthNames ()
 

Private Attributes

const FORMAT_NAME = 'date-format'
 
 $isoTimestampParser
 

Detailed Description

This parser is in essence the inverse operation of MediaWiki's Language::sprintfDate.

See also
\Language::sprintfDate
Author
Thiemo Kreuz

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Repo\Parsers\DateFormatParser::__construct ( ParserOptions $options = null)

Member Function Documentation

◆ findMonthMatch()

Wikibase\Repo\Parsers\DateFormatParser::findMonthMatch ( $matches)
private
Parameters
string[]$matches
Returns
int|string

◆ getDateFormat()

Wikibase\Repo\Parsers\DateFormatParser::getDateFormat ( )
private
Returns
string

◆ getDigitTransformTable()

Wikibase\Repo\Parsers\DateFormatParser::getDigitTransformTable ( )
private
Returns
string[]|null

◆ getMonthNames()

Wikibase\Repo\Parsers\DateFormatParser::getMonthNames ( )
private
Returns
array[]|string[]

◆ getMonthNamesPattern()

Wikibase\Repo\Parsers\DateFormatParser::getMonthNamesPattern ( )
private
Returns
string Partial regular expression

◆ getNumberPattern()

Wikibase\Repo\Parsers\DateFormatParser::getNumberPattern ( )
private
Returns
string Partial regular expression

◆ parseDate()

Wikibase\Repo\Parsers\DateFormatParser::parseDate ( $input)
private
Parameters
string$input
Exceptions
ParseException
Returns
string[] Guaranteed to have the "year" key, optionally followed by more elements. Guaranteed to be continuous, e.g. "year" and "day" with no "month" is illegal.

◆ parseDateFormat()

Wikibase\Repo\Parsers\DateFormatParser::parseDateFormat ( $format)
private
See also
Language::sprintfDate
Parameters
string$formatA date format, as described in Language::sprintfDate.
Returns
string Regular expression

◆ parseFormattedNumber()

Wikibase\Repo\Parsers\DateFormatParser::parseFormattedNumber ( $number)
private
Parameters
string$number
Returns
string Canonical number

◆ stringParse()

Wikibase\Repo\Parsers\DateFormatParser::stringParse ( $value)
protected
See also
StringValueParser::stringParse
Parameters
string$value
Exceptions
ParseException
Returns
TimeValue

Member Data Documentation

◆ $isoTimestampParser

Wikibase\Repo\Parsers\DateFormatParser::$isoTimestampParser
private

◆ FORMAT_NAME

const Wikibase\Repo\Parsers\DateFormatParser::FORMAT_NAME = 'date-format'
private

◆ OPT_DATE_FORMAT

const Wikibase\Repo\Parsers\DateFormatParser::OPT_DATE_FORMAT = 'dateFormat'

◆ OPT_DIGIT_TRANSFORM_TABLE

const Wikibase\Repo\Parsers\DateFormatParser::OPT_DIGIT_TRANSFORM_TABLE = 'digitTransformTable'

Option for unlocalizing non-canonical digits.

Must be an array of strings, mapping canonical digit characters ("1", "2" and so on, possibly including "." and ",") to localized characters.

◆ OPT_MONTH_NAMES

const Wikibase\Repo\Parsers\DateFormatParser::OPT_MONTH_NAMES = 'monthNames'

Option for localized month names.

Should be a two-dimensional array, the first dimension mapping the month's numbers 1 to 12 to arrays of localized month names, possibly including full month names, genitive names and abbreviations. Can also be a one-dimensional array of strings.

◆ OPT_PRECISION

const Wikibase\Repo\Parsers\DateFormatParser::OPT_PRECISION = 'precision'

Option to override the precision auto-detection and set a specific precision.

Should be an integer or string containing one of the TimeValue::PRECISION_... constants.


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