MediaWiki  master
RawMessage.php
Go to the documentation of this file.
1 <?php
35 class RawMessage extends Message {
36 
49  public function __construct( $text, $params = [] ) {
50  if ( !is_string( $text ) ) {
51  throw new InvalidArgumentException( '$text must be a string' );
52  }
53 
54  parent::__construct( $text, $params );
55 
56  // The key is the message.
57  $this->message = $text;
58  }
59 
65  public function fetchMessage() {
66  // Just in case the message is unset somewhere.
67  if ( $this->message === null ) {
68  $this->message = $this->key;
69  }
70 
71  return $this->message;
72  }
73 
74 }
Message\$message
string $message
Definition: Message.php:239
RawMessage\__construct
__construct( $text, $params=[])
Call the parent constructor, then store the key as the message.
Definition: RawMessage.php:49
Message\$key
string $key
The message key.
Definition: Message.php:203
Message
The Message class deals with fetching and processing of interface message into a variety of formats.
Definition: Message.php:161
RawMessage
Variant of the Message class.
Definition: RawMessage.php:35
RawMessage\fetchMessage
fetchMessage()
Fetch the message (in this case, the key).
Definition: RawMessage.php:65