MediaWiki  master
RawMessage.php
Go to the documentation of this file.
1 <?php
34 class 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
fetchMessage()
Fetch the message (in this case, the key).
Definition: RawMessage.php:63
string $key
The message key.
Definition: Message.php:204
__construct( $text, $params=[])
Call the parent constructor, then store the key as the message.
Definition: RawMessage.php:47
Variant of the Message class.
Definition: RawMessage.php:34
string $message
Definition: Message.php:240