MediaWiki  1.28.0
ApiMessage Class Reference

Extension of Message implementing IApiMessage. More...

Inheritance diagram for ApiMessage:
Collaboration diagram for ApiMessage:

Public Member Functions

 __construct ($msg, $code=null, array $data=null)
 
- Public Member Functions inherited from Message
 __construct ($key, $params=[], Language $language=null)
 
 __toString ()
 Magic method implementation of the above (for PHP >= 5.2.0), so we can do, eg: $foo = new Message( $key ); $string = "<abbr>$foo</abbr>";. More...
 
 bitrateParams ()
 Add parameters that are bitrates and will be passed through Language::formatBitrate before substitution. More...
 
 content ()
 Returns the message as a Content object. More...
 
 durationParams ()
 Add parameters that are durations of time and will be passed through Language::formatDuration before substitution. More...
 
 escaped ()
 Returns the message text. More...
 
 exists ()
 Check whether a message key has been defined currently. More...
 
 expiryParams ()
 Add parameters that are expiration times and will be passed through Language::formatExpiry before substitution. More...
 
 getFormat ()
 Returns the message format. More...
 
 getKey ()
 Returns the message key. More...
 
 getKeysToTry ()
 
 getLanguage ()
 Returns the Language of the Message. More...
 
 getParams ()
 Returns the message parameters. More...
 
 getTitle ()
 Get a title object for a mediawiki message, where it can be found in the mediawiki namespace. More...
 
 inContentLanguage ()
 Request the message in the wiki's content language, unless it is disabled for this message. More...
 
 inLanguage ($lang)
 Request the message in any language that is supported. More...
 
 isBlank ()
 Check whether a message does not exist, or is an empty string. More...
 
 isDisabled ()
 Check whether a message does not exist, is an empty string, or is "-". More...
 
 isMultiKey ()
 
 numParams ()
 Add parameters that are numeric and will be passed through Language::formatNum before substitution. More...
 
 params ()
 Adds parameters to the parameter list of this message. More...
 
 parse ()
 Fully parse the text from wikitext to HTML. More...
 
 parseAsBlock ()
 Returns the parsed message text which is always surrounded by a block element. More...
 
 plain ()
 Returns the message text as-is, only parameters are substituted. More...
 
 plaintextParams ()
 Add parameters that are plaintext and will be passed through without the content being evaluated. More...
 
 rawParams ()
 Add parameters that are substituted after parsing or escaping. More...
 
 serialize ()
 
 setContext (IContextSource $context)
 Set the language and the title from a context object. More...
 
 setInterfaceMessageFlag ($interface)
 Allows manipulating the interface message flag directly. More...
 
 sizeParams ()
 Add parameters that are file sizes and will be passed through Language::formatSize before substitution. More...
 
 text ()
 Returns the message text. More...
 
 timeperiodParams ()
 Add parameters that are time periods and will be passed through Language::formatTimePeriod before substitution. More...
 
 title ($title)
 Set the Title object to use as context when transforming the message. More...
 
 toString ()
 Returns the message parsed from wikitext to HTML. More...
 
 unserialize ($serialized)
 
 useDatabase ($useDatabase)
 Enable or disable database use. More...
 
- Public Member Functions inherited from IApiMessage
 getApiCode ()
 Returns a machine-readable code for use by the API. More...
 
 getApiData ()
 Returns additional machine-readable data about the error condition. More...
 
 setApiCode ($code, array $data=null)
 Sets the machine-readable code for use by the API. More...
 
 setApiData (array $data)
 Sets additional machine-readable data about the error condition. More...
 

Static Public Member Functions

static create ($msg, $code=null, array $data=null)
 Create an IApiMessage for the message. More...
 
- Static Public Member Functions inherited from Message
static bitrateParam ($bitrate)
 
static durationParam ($duration)
 
static expiryParam ($expiry)
 
static newFallbackSequence ()
 Factory function accepting multiple message keys and returning a message instance for the first message which is non-empty. More...
 
static newFromKey ($key)
 Factory function that is just wrapper for the real constructor. More...
 
static newFromSpecifier ($value)
 Transform a MessageSpecifier or a primitive value used interchangeably with specifiers (a message key string, or a key + params array) into a proper Message. More...
 
static numParam ($num)
 
static plaintextParam ($plaintext)
 
static rawParam ($raw)
 
static sizeParam ($size)
 
static timeperiodParam ($period)
 

Additional Inherited Members

- Protected Member Functions inherited from Message
 extractParam ($param)
 Extracts the parameter type and preprocessed the value if needed. More...
 
 fetchMessage ()
 Wrapper for what ever method we use to get message contents. More...
 
 formatPlaintext ($plaintext)
 Formats a message parameter wrapped with 'plaintext'. More...
 
 parseText ($string)
 Wrapper for what ever method we use to parse wikitext. More...
 
 replaceParameters ($message, $type= 'before')
 Substitutes any parameters into the message text. More...
 
 transformText ($string)
 Wrapper for what ever method we use to {{-transform wikitext. More...
 
- Protected Attributes inherited from Message
Content $content = null
 Content object representing the message. More...
 
string $format = 'parse'
 Format for the message. More...
 
bool $interface = true
 In which language to get this message. More...
 
string $key
 The message key. More...
 
string[] $keysToTry
 List of keys to try when fetching the message. More...
 
Language bool $language = false
 In which language to get this message. More...
 
string $message
 
array $parameters = []
 List of parameters which will be substituted into the message. More...
 
Title $title = null
 Title object to use as context. More...
 
bool $useDatabase = true
 Whether database can be used. More...
 

Detailed Description

Extension of Message implementing IApiMessage.

Since
1.25

Definition at line 115 of file ApiMessage.php.

Constructor & Destructor Documentation

ApiMessage::__construct (   $msg,
  $code = null,
array  $data = null 
)
Parameters
Message | string | array$msg
string | null$code
array | null$data
Returns
ApiMessage

Definition at line 148 of file ApiMessage.php.

References $code, Message\$key, $value, array(), and as.

Member Function Documentation

static ApiMessage::create (   $msg,
  $code = null,
array  $data = null 
)
static

Create an IApiMessage for the message.

This returns $msg if it's an IApiMessage, calls 'new ApiRawMessage' if $msg is a RawMessage, or calls 'new ApiMessage' in all other cases.

Parameters
Message | RawMessage | array | string$msg
string | null$code
array | null$data
Returns
ApiMessage

Definition at line 129 of file ApiMessage.php.

References $code.

Referenced by ApiErrorFormatter\addError(), ApiErrorFormatter\addMessagesFromStatus(), ApiErrorFormatter\addWarning(), and ApiMessageTest\testApiMessageCreate().


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