Merge "Make sure Parsoid doesn't get snobbish and treat non-html5 tags badly."
[lhc/web/wiklou.git] / includes / Message.php
index 96747c9..d8a94f9 100644 (file)
@@ -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
@@ -252,9 +285,9 @@ class Message {
        public static function newFallbackSequence( /*...*/ ) {
                $keys = func_get_args();
                if ( func_num_args() == 1 ) {
-                       if ( is_array($keys[0]) ) {
+                       if ( is_array( $keys[0] ) ) {
                                // Allow an array to be passed as the first argument instead
-                               $keys = array_values($keys[0]);
+                               $keys = array_values( $keys[0] );
                        } else {
                                // Optimize a single string to not need special fallback handling
                                $keys = $keys[0];
@@ -416,7 +449,7 @@ class Message {
         */
        public function content() {
                if ( !$this->content ) {
-                       $this->content = new MessageContent( $this->key );
+                       $this->content = new MessageContent( $this );
                }
 
                return $this->content;
@@ -431,7 +464,7 @@ class Message {
                $string = $this->fetchMessage();
 
                if ( $string === false ) {
-                       $key =  htmlspecialchars( is_array( $this->key ) ? $this->key[0] : $this->key );
+                       $key = htmlspecialchars( is_array( $this->key ) ? $this->key[0] : $this->key );
                        if ( $this->format === 'plain' ) {
                                return '<' . $key . '>';
                        }
@@ -474,7 +507,7 @@ class Message {
 
        /**
         * Magic method implementation of the above (for PHP >= 5.2.0), so we can do, eg:
-        *     $foo = Message::get($key);
+        *     $foo = Message::get( $key );
         *     $string = "<abbr>$foo</abbr>";
         * @since 1.18
         * @return String
@@ -710,8 +743,8 @@ class RawMessage extends Message {
         * Call the parent constructor, then store the key as
         * the message.
         *
-        * @param $key Message to use
-        * @param $params Parameters for the message
+        * @param $key string Message to use
+        * @param $params array Parameters for the message
         * @see Message::__construct
         */
        public function __construct( $key, $params = array() ) {