Update formatting and documentation in includes/context/
authorSiebrand Mazeland <s.mazeland@xs4all.nl>
Wed, 20 Nov 2013 05:21:57 +0000 (06:21 +0100)
committerSiebrand <siebrand@wikimedia.org>
Wed, 20 Nov 2013 05:25:22 +0000 (05:25 +0000)
Change-Id: I8bfdbe8f6d9c325063678e24a9d604f18eb83fc3

includes/context/ContextSource.php
includes/context/DerivativeContext.php
includes/context/RequestContext.php

index e13cfa8..0a3f18f 100644 (file)
@@ -41,9 +41,11 @@ abstract class ContextSource implements IContextSource {
        public function getContext() {
                if ( $this->context === null ) {
                        $class = get_class( $this );
-                       wfDebug( __METHOD__ . " ($class): called and \$context is null. Using RequestContext::getMain() for sanity\n" );
+                       wfDebug( __METHOD__ . " ($class): called and \$context is null. " .
+                               "Using RequestContext::getMain() for sanity\n" );
                        $this->context = RequestContext::getMain();
                }
+
                return $this->context;
        }
 
@@ -130,6 +132,7 @@ abstract class ContextSource implements IContextSource {
         */
        public function getLang() {
                wfDeprecated( __METHOD__, '1.19' );
+
                return $this->getLanguage();
        }
 
@@ -162,6 +165,7 @@ abstract class ContextSource implements IContextSource {
         */
        public function msg( /* $args */ ) {
                $args = func_get_args();
+
                return call_user_func_array( array( $this->getContext(), 'msg' ), $args );
        }
 
index fd9bf96..e96269d 100644 (file)
@@ -99,6 +99,7 @@ class DerivativeContext extends ContextSource {
         * Set the Title object
         *
         * @param Title $t
+        * @throws MWException
         */
        public function setTitle( $t ) {
                if ( $t !== null && !$t instanceof Title ) {
@@ -298,6 +299,7 @@ class DerivativeContext extends ContextSource {
         */
        public function msg() {
                $args = func_get_args();
+
                return call_user_func_array( 'wfMessage', $args )->setContext( $this );
        }
 }
index 01ec57c..04879e2 100644 (file)
@@ -82,6 +82,7 @@ class RequestContext implements IContextSource {
                        global $wgRequest; # fallback to $wg till we can improve this
                        $this->request = $wgRequest;
                }
+
                return $this->request;
        }
 
@@ -89,6 +90,7 @@ class RequestContext implements IContextSource {
         * Set the Title object
         *
         * @param Title $t
+        * @throws MWException
         */
        public function setTitle( $t ) {
                if ( $t !== null && !$t instanceof Title ) {
@@ -109,6 +111,7 @@ class RequestContext implements IContextSource {
                        global $wgTitle; # fallback to $wg till we can improve this
                        $this->title = $wgTitle;
                }
+
                return $this->title;
        }
 
@@ -169,6 +172,7 @@ class RequestContext implements IContextSource {
                        }
                        $this->wikipage = WikiPage::factory( $title );
                }
+
                return $this->wikipage;
        }
 
@@ -188,6 +192,7 @@ class RequestContext implements IContextSource {
                if ( $this->output === null ) {
                        $this->output = new OutputPage( $this );
                }
+
                return $this->output;
        }
 
@@ -209,6 +214,7 @@ class RequestContext implements IContextSource {
                if ( $this->user === null ) {
                        $this->user = User::newFromSession( $this->getRequest() );
                }
+
                return $this->user;
        }
 
@@ -269,6 +275,7 @@ class RequestContext implements IContextSource {
         */
        public function getLang() {
                wfDeprecated( __METHOD__, '1.19' );
+
                return $this->getLanguage();
        }
 
@@ -364,6 +371,7 @@ class RequestContext implements IContextSource {
                        $this->skin->setContext( $this );
                        wfProfileOut( __METHOD__ . '-createskin' );
                }
+
                return $this->skin;
        }
 
@@ -377,6 +385,7 @@ class RequestContext implements IContextSource {
         */
        public function msg() {
                $args = func_get_args();
+
                return call_user_func_array( 'wfMessage', $args )->setContext( $this );
        }
 
@@ -392,6 +401,7 @@ class RequestContext implements IContextSource {
                if ( $instance === null ) {
                        $instance = new self;
                }
+
                return $instance;
        }
 
@@ -446,7 +456,7 @@ class RequestContext implements IContextSource {
                        $user = User::newFromName( $params['ip'], false );
                }
 
-               $importSessionFunction = function( User $user, array $params ) {
+               $importSessionFunction = function ( User $user, array $params ) {
                        global $wgRequest, $wgUser;
 
                        $context = RequestContext::getMain();
@@ -482,7 +492,7 @@ class RequestContext implements IContextSource {
                $importSessionFunction( $user, $params );
 
                // Set callback to save and close the new session and reload the old one
-               return new ScopedCallback( function() use ( $importSessionFunction, $oUser, $oParams ) {
+               return new ScopedCallback( function () use ( $importSessionFunction, $oUser, $oParams ) {
                        $importSessionFunction( $oUser, $oParams );
                } );
        }
@@ -510,6 +520,7 @@ class RequestContext implements IContextSource {
                        $context->setRequest( new FauxRequest( $request ) );
                }
                $context->user = User::newFromName( '127.0.0.1', false );
+
                return $context;
        }
 }