MediaWiki REL1_37
MediaWiki\Message\TextFormatter Class Reference

The MediaWiki-specific implementation of ITextFormatter. More...

Inheritance diagram for MediaWiki\Message\TextFormatter:
Collaboration diagram for MediaWiki\Message\TextFormatter:

Public Member Functions

 __construct (string $langCode, Converter $converter, string $format=Message::FORMAT_TEXT)
 Construct a TextFormatter.
 
 format (MessageValue $mv)
 Convert a MessageValue to text.
 
 getLangCode ()
 Get the internal language code in which format() is.
 

Private Attributes

Converter $converter
 
string $format
 
string $langCode
 

Detailed Description

The MediaWiki-specific implementation of ITextFormatter.

Definition at line 12 of file TextFormatter.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Message\TextFormatter::__construct ( string  $langCode,
Converter  $converter,
string  $format = Message::FORMAT_TEXT 
)

Construct a TextFormatter.

The type signature may change without notice as dependencies are added to the constructor. External callers should use MediaWikiServices::getMessageFormatterFactory()

Access: internal
Parameters
string$langCode
Converter$converter
string$format

Definition at line 34 of file TextFormatter.php.

References MediaWiki\Message\TextFormatter\$converter, MediaWiki\Message\TextFormatter\$format, MediaWiki\Message\TextFormatter\$langCode, and MediaWiki\Message\TextFormatter\format().

Member Function Documentation

◆ format()

MediaWiki\Message\TextFormatter::format ( MessageValue  $message)

Convert a MessageValue to text.

The result is not safe for use as raw HTML.

Parameters
MessageValue$message
Returns
string

Implements Wikimedia\Message\ITextFormatter.

Definition at line 48 of file TextFormatter.php.

References MediaWiki\Message\TextFormatter\format().

Referenced by MediaWiki\Message\TextFormatter\__construct(), and MediaWiki\Message\TextFormatter\format().

◆ getLangCode()

MediaWiki\Message\TextFormatter::getLangCode ( )

Get the internal language code in which format() is.

Returns
string

Implements Wikimedia\Message\ITextFormatter.

Definition at line 44 of file TextFormatter.php.

References MediaWiki\Message\TextFormatter\$langCode.

Member Data Documentation

◆ $converter

Converter MediaWiki\Message\TextFormatter::$converter
private

Definition at line 14 of file TextFormatter.php.

Referenced by MediaWiki\Message\TextFormatter\__construct().

◆ $format

string MediaWiki\Message\TextFormatter::$format
private

Definition at line 20 of file TextFormatter.php.

Referenced by MediaWiki\Message\TextFormatter\__construct().

◆ $langCode

string MediaWiki\Message\TextFormatter::$langCode
private

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