MediaWiki REL1_34
RawMessage.php
Go to the documentation of this file.
1<?php
34class RawMessage extends Message {
35
47 public function __construct( $text, $params = [] ) {
48 if ( !is_string( $text ) ) {
49 throw new InvalidArgumentException( '$text must be a string' );
50 }
51
52 parent::__construct( $text, $params );
53
54 // The key is the message.
55 $this->message = $text;
56 }
57
63 public function fetchMessage() {
64 // Just in case the message is unset somewhere.
65 if ( $this->message === null ) {
66 $this->message = $this->key;
67 }
68
69 return $this->message;
70 }
71
72}
The Message class provides methods which fulfil two basic services:
Definition Message.php:162
string $key
The message key.
Definition Message.php:204
string $message
Definition Message.php:240
Variant of the Message class.
fetchMessage()
Fetch the message (in this case, the key).
__construct( $text, $params=[])
Call the parent constructor, then store the key as the message.