MediaWiki master
MediaWiki\Message\TextFormatter Class Reference

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

Inherits Wikimedia\Message\ITextFormatter.

Collaboration diagram for MediaWiki\Message\TextFormatter:

Public Member Functions

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

Protected Member Functions

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

Detailed Description

The MediaWiki-specific implementation of ITextFormatter.

To obtain an instance, use \MediaWiki\MediaWikiServices::getMessageFormatterFactory() and call MessageFormatterFactory::getTextFormatter.

Definition at line 16 of file TextFormatter.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Message\TextFormatter::__construct ( string $langCode,
string $format = Message::FORMAT_TEXT )
Access: internal
For use by ServiceWiring only
Parameters
string$langCode
string$format

Definition at line 25 of file TextFormatter.php.

References MediaWiki\Message\TextFormatter\format().

Member Function Documentation

◆ createMessage()

MediaWiki\Message\TextFormatter::createMessage ( MessageSpecifier $spec)
protected

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

Access: internal
Parameters
MessageSpecifier$spec
Returns
Message

Definition at line 45 of file TextFormatter.php.

◆ format()

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

Convert a MessageSpecifier to text.

The result is not safe for use as raw HTML.

Parameters
MessageSpecifier$message
Returns
string

Implements Wikimedia\Message\ITextFormatter.

Definition at line 49 of file TextFormatter.php.

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

◆ getLangCode()

MediaWiki\Message\TextFormatter::getLangCode ( )

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

Returns
string

Implements Wikimedia\Message\ITextFormatter.

Definition at line 33 of file TextFormatter.php.


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