mMessage = wfMessage( $msg ); } else { $this->mMessage = clone $msg; } if ( $params ) { $this->mMessage = $this->mMessage->params( $params ); } } /** * Returns the message text. {{-transformation is done. * * @return string Unescaped message text. */ public function getWikitext() { return $this->mMessage->text(); } /** * Returns the message object, with any parameters already substituted. * * @deprecated since 1.33 use getMessage() instead. * * @return Message */ public function getNativeData() { return $this->getMessage(); } /** * Returns the message object, with any parameters already substituted. * * @since 1.33 * * @return Message */ public function getMessage() { // NOTE: Message objects are mutable. Cloning here makes MessageContent immutable. return clone $this->mMessage; } /** * @return string * * @see Content::getTextForSearchIndex */ public function getTextForSearchIndex() { return $this->mMessage->plain(); } /** * @return string * * @see Content::getWikitextForTransclusion */ public function getWikitextForTransclusion() { return $this->getWikitext(); } /** * @param int $maxlength Maximum length of the summary text, defaults to 250. * * @return string The summary text. * * @see Content::getTextForSummary */ public function getTextForSummary( $maxlength = 250 ) { return $this->mMessage->getLanguage()->truncateForDatabase( $this->mMessage->plain(), $maxlength, '' ); } /** * @return int * * @see Content::getSize */ public function getSize() { return strlen( $this->mMessage->plain() ); } /** * @return Content A copy of this object * * @see Content::copy */ public function copy() { // MessageContent is immutable (because getNativeData() and getMessage() // returns a clone of the Message object) return $this; } /** * @param bool|null $hasLinks * * @return bool Always false. * * @see Content::isCountable */ public function isCountable( $hasLinks = null ) { return false; } }