MediaWiki  master
Message\Converter Class Reference

Converter between Message and MessageValue. More...

Public Member Functions

 convertMessage (Message $m)
 Convert a Message to a MessageValue. More...
 
 convertMessageValue (MessageValue $mv)
 Convert a MessageValue to a Message. More...
 
 createMessage ( $key)
 Allow the Message class to be mocked in tests by constructing objects in a protected method. More...
 

Private Member Functions

 convertMessageParam (MessageParam $param)
 Convert a MessageParam to a Message parameter. More...
 
 convertParam ( $param)
 Convert a Message parameter to a MessageParam. More...
 

Static Private Member Functions

static getTypes ()
 Return the ParamType constants. More...
 

Static Private Attributes

static string[] null $constants = null
 ParamType constants. More...
 

Detailed Description

Converter between Message and MessageValue.

Since
1.35

Definition at line 18 of file Converter.php.

Member Function Documentation

◆ convertMessage()

Message\Converter::convertMessage ( Message  $m)

Convert a Message to a MessageValue.

Parameters
Message$m
Returns
MessageValue

Definition at line 53 of file Converter.php.

References Message\Converter\convertParam(), Message\getKey(), and Message\getParams().

Referenced by Message\Converter\convertParam().

◆ convertMessageParam()

Message\Converter::convertMessageParam ( MessageParam  $param)
private

Convert a MessageParam to a Message parameter.

Parameters
MessageParam$param
Returns
array|string|int

Definition at line 109 of file Converter.php.

References Message\Converter\convertMessageValue(), Message\listParam(), and Wikimedia\Message\ParamType\TEXT.

Referenced by Message\Converter\convertMessageValue().

◆ convertMessageValue()

Message\Converter::convertMessageValue ( MessageValue  $mv)

Convert a MessageValue to a Message.

Parameters
MessageValue$mv
Returns
Message

Definition at line 96 of file Converter.php.

References Message\Converter\convertMessageParam(), and Message\Converter\createMessage().

Referenced by Message\Converter\convertMessageParam().

◆ convertParam()

Message\Converter::convertParam (   $param)
private

Convert a Message parameter to a MessageParam.

Parameters
array | string | int$param
Returns
MessageParam

Definition at line 66 of file Converter.php.

References $type, Message\Converter\convertMessage(), Wikimedia\Message\ParamType\LIST, and Wikimedia\Message\ParamType\TEXT.

Referenced by Message\Converter\convertMessage().

◆ createMessage()

Message\Converter::createMessage (   $key)

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

Access: internal
Parameters
string$key
Returns
Message

Definition at line 44 of file Converter.php.

Referenced by Message\Converter\convertMessageValue().

◆ getTypes()

static Message\Converter::getTypes ( )
staticprivate

Return the ParamType constants.

Returns
string[]

Definition at line 27 of file Converter.php.

References Message\Converter\$constants.

Member Data Documentation

◆ $constants

string [] null Message\Converter::$constants = null
staticprivate

ParamType constants.

Definition at line 21 of file Converter.php.

Referenced by Message\Converter\getTypes().


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