Merge "jquery.suggestions: Use document width instead of <body> width for position...
[lhc/web/wiklou.git] / includes / context / DerivativeContext.php
index a4e3272..d4caf05 100644 (file)
@@ -30,7 +30,6 @@
  *     a different Title instance set on it.
  */
 class DerivativeContext extends ContextSource {
-
        /**
         * @var WebRequest
         */
@@ -68,7 +67,7 @@ class DerivativeContext extends ContextSource {
 
        /**
         * Constructor
-        * @param $context IContextSource Context to inherit from
+        * @param IContextSource $context Context to inherit from
         */
        public function __construct( IContextSource $context ) {
                $this->setContext( $context );
@@ -77,7 +76,7 @@ class DerivativeContext extends ContextSource {
        /**
         * Set the WebRequest object
         *
-        * @param $r WebRequest object
+        * @param WebRequest $r
         */
        public function setRequest( WebRequest $r ) {
                $this->request = $r;
@@ -99,7 +98,7 @@ class DerivativeContext extends ContextSource {
        /**
         * Set the Title object
         *
-        * @param $t Title object
+        * @param Title $t
         */
        public function setTitle( Title $t ) {
                $this->title = $t;
@@ -140,7 +139,7 @@ class DerivativeContext extends ContextSource {
         * Set the WikiPage object
         *
         * @since 1.19
-        * @param $p WikiPage object
+        * @param WikiPage $p
         */
        public function setWikiPage( WikiPage $p ) {
                $this->wikipage = $p;
@@ -166,7 +165,7 @@ class DerivativeContext extends ContextSource {
        /**
         * Set the OutputPage object
         *
-        * @param $o OutputPage
+        * @param OutputPage $o
         */
        public function setOutput( OutputPage $o ) {
                $this->output = $o;
@@ -175,7 +174,7 @@ class DerivativeContext extends ContextSource {
        /**
         * Get the OutputPage object
         *
-        * @return OutputPage object
+        * @return OutputPage
         */
        public function getOutput() {
                if ( !is_null( $this->output ) ) {
@@ -188,7 +187,7 @@ class DerivativeContext extends ContextSource {
        /**
         * Set the User object
         *
-        * @param $u User
+        * @param User $u
         */
        public function setUser( User $u ) {
                $this->user = $u;
@@ -210,8 +209,8 @@ class DerivativeContext extends ContextSource {
        /**
         * Set the Language object
         *
-        * @deprecated 1.19 Use setLanguage instead
-        * @param $l Mixed Language instance or language code
+        * @deprecated since 1.19 Use setLanguage instead
+        * @param Language|string $l Language instance or language code
         */
        public function setLang( $l ) {
                wfDeprecated( __METHOD__, '1.19' );
@@ -221,7 +220,7 @@ class DerivativeContext extends ContextSource {
        /**
         * Set the Language object
         *
-        * @param $l Mixed Language instance or language code
+        * @param Language|string $l Language instance or language code
         * @throws MWException
         * @since 1.19
         */
@@ -238,7 +237,7 @@ class DerivativeContext extends ContextSource {
        }
 
        /**
-        * @deprecated 1.19 Use getLanguage instead
+        * @deprecated since 1.19 Use getLanguage instead
         * @return Language
         */
        public function getLang() {
@@ -263,7 +262,7 @@ class DerivativeContext extends ContextSource {
        /**
         * Set the Skin object
         *
-        * @param $s Skin
+        * @param Skin $s
         */
        public function setSkin( Skin $s ) {
                $this->skin = clone $s;
@@ -283,5 +282,19 @@ class DerivativeContext extends ContextSource {
                }
        }
 
+       /**
+        * Get a message using the current context.
+        *
+        * This can't just inherit from ContextSource, since then
+        * it would set only the original context, and not take
+        * into account any changes.
+        *
+        * @param String Message name
+        * @param Variable number of message arguments
+        * @return Message
+        */
+       public function msg() {
+               $args = func_get_args();
+               return call_user_func_array( 'wfMessage', $args )->setContext( $this );
+       }
 }
-