MediaWiki  master
RawMessage.php
Go to the documentation of this file.
1 <?php
22 
23 use InvalidArgumentException;
24 use Message;
25 
40 class RawMessage extends Message {
41 
54  public function __construct( $text, $params = [] ) {
55  if ( !is_string( $text ) ) {
56  throw new InvalidArgumentException( '$text must be a string' );
57  }
58 
59  parent::__construct( $text, $params );
60 
61  // The key is the message.
62  $this->message = $text;
63  }
64 
70  public function fetchMessage() {
71  // Just in case the message is unset somewhere.
72  $this->message ??= $this->key;
73 
74  return $this->message;
75  }
76 
77 }
78 
82 class_alias( RawMessage::class, 'RawMessage' );
Variant of the Message class.
Definition: RawMessage.php:40
__construct( $text, $params=[])
Call the parent constructor, then store the key as the message.
Definition: RawMessage.php:54
fetchMessage()
Fetch the message (in this case, the key).
Definition: RawMessage.php:70
The Message class deals with fetching and processing of interface message into a variety of formats.
Definition: Message.php:144
string null false $message
Definition: Message.php:217
string $key
The message key.
Definition: Message.php:186