Wikibase
MediaWiki Wikibase extension
Wikibase\Repo\Parsers\MwEraParser Class Reference

Class to parse localized era from values. More...

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

Public Member Functions

 __construct (ParserOptions $options)
 

Public Attributes

const FORMAT_NAME = 'mw-era'
 
const BCE_MESSAGE_KEY = 'wikibase-time-precision-BCE'
 
const CE_MESSAGE_KEY = 'wikibase-time-precision-CE'
 

Protected Member Functions

 stringParse ( $value)
 

Private Member Functions

 parseEra ( $value, Language $language)
 Try to parse era from the value in the given language. More...
 
 parseEraWithMessage (string $value, string $msgText)
 Try to parse the era from the value using the given message text. More...
 
 getRegexpFromMessageText ( $msgText)
 Transform the message to a pattern we can match era against. More...
 

Private Attributes

 $lang
 

Detailed Description

Class to parse localized era from values.

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Repo\Parsers\MwEraParser::__construct ( ParserOptions  $options)

Member Function Documentation

◆ getRegexpFromMessageText()

Wikibase\Repo\Parsers\MwEraParser::getRegexpFromMessageText (   $msgText)
private

Transform the message to a pattern we can match era against.

Parameters
$msgTextstring
Returns
string

◆ parseEra()

Wikibase\Repo\Parsers\MwEraParser::parseEra (   $value,
Language  $language 
)
private

Try to parse era from the value in the given language.

Parameters
string$value
Language$language
Returns
string[]|null

◆ parseEraWithMessage()

Wikibase\Repo\Parsers\MwEraParser::parseEraWithMessage ( string  $value,
string  $msgText 
)
private

Try to parse the era from the value using the given message text.

Parameters
string$value
string$msgText
Returns
string|null The value with the era stripped (if it can be parsed).

◆ stringParse()

Wikibase\Repo\Parsers\MwEraParser::stringParse (   $value)
protected
Parameters
string$value
Exceptions
ParseException
Returns
string[] Array of the parsed era constant and the value with the era stripped.

Member Data Documentation

◆ $lang

Wikibase\Repo\Parsers\MwEraParser::$lang
private

◆ BCE_MESSAGE_KEY

const Wikibase\Repo\Parsers\MwEraParser::BCE_MESSAGE_KEY = 'wikibase-time-precision-BCE'

◆ CE_MESSAGE_KEY

const Wikibase\Repo\Parsers\MwEraParser::CE_MESSAGE_KEY = 'wikibase-time-precision-CE'

◆ FORMAT_NAME

const Wikibase\Repo\Parsers\MwEraParser::FORMAT_NAME = 'mw-era'

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