MediaWiki REL1_34
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 ( $langCode)
 Construct a TextFormatter.
 
 format (MessageValue $mv)
 Convert a MessageValue to text.
 
 getLangCode ()
 Get the internal language code in which format() is.
 

Protected Member Functions

 createMessage ( $key)
 Allow the Message class to be mocked in tests by constructing objects in a protected method.
 

Private Member Functions

 convertParam (MessageParam $param)
 

Private Attributes

string $langCode
 

Detailed Description

The MediaWiki-specific implementation of ITextFormatter.

Definition at line 15 of file TextFormatter.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Message\TextFormatter::__construct (   $langCode)

Construct a TextFormatter.

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

Definition at line 28 of file TextFormatter.php.

References MediaWiki\Message\TextFormatter\$langCode.

Member Function Documentation

◆ convertParam()

◆ createMessage()

MediaWiki\Message\TextFormatter::createMessage (   $key)
protected

Allow the Message class to be mocked in tests by constructing objects in a protected method.

Definition at line 40 of file TextFormatter.php.

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

◆ 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 75 of file TextFormatter.php.

References MediaWiki\Message\TextFormatter\convertParam(), MediaWiki\Message\TextFormatter\createMessage(), Wikimedia\Message\MessageValue\getKey(), and Wikimedia\Message\MessageValue\getParams().

◆ 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

◆ $langCode

string MediaWiki\Message\TextFormatter::$langCode
private

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