From: daniel Date: Tue, 19 Feb 2013 19:28:57 +0000 (+0100) Subject: Add getters to Message object. X-Git-Tag: 1.31.0-rc.0~20638^2 X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dmembres/fiche.php?a=commitdiff_plain;h=c0f47c445a075db4f5d19baccef493fdab022579;p=lhc%2Fweb%2Fwiklou.git Add getters to Message object. Being able to get the message key and parameters from a Message object is needed to be able to report errors from the API in an abstract, language neutral way. Change-Id: I8ee9da4005db7cb0a487457127f1e24fb11dbd66 --- diff --git a/includes/Message.php b/includes/Message.php index 8d8cdeeb70..6e533a317e 100644 --- a/includes/Message.php +++ b/includes/Message.php @@ -226,6 +226,39 @@ class Message { $this->language = $wgLang; } + /** + * Returns the message key + * + * @since 1.21 + * + * @return string + */ + public function getKey() { + return $this->key; + } + + /** + * Returns the message parameters + * + * @since 1.21 + * + * @return string[] + */ + public function getParams() { + return $this->parameters; + } + + /** + * Returns the message format + * + * @since 1.21 + * + * @return string + */ + public function getFormat() { + return $this->format; + } + /** * Factory function that is just wrapper for the real constructor. It is * intented to be used instead of the real constructor, because it allows diff --git a/includes/Status.php b/includes/Status.php index 4298aee984..449b656b2e 100644 --- a/includes/Status.php +++ b/includes/Status.php @@ -231,6 +231,10 @@ class Status { /** * Get the error message as HTML. This is done by parsing the wikitext error * message. + * + * @note: this does not perform a full wikitext to HTML conversion, it merely applies + * a message transformation. + * @todo: figure out whether that is actually The Right Thing. */ public function getHTML( $shortContext = false, $longContext = false ) { $text = $this->getWikiText( $shortContext, $longContext );