Fixup/add documentation
authorSam Reed <reedy@users.mediawiki.org>
Sat, 21 May 2011 17:45:20 +0000 (17:45 +0000)
committerSam Reed <reedy@users.mediawiki.org>
Sat, 21 May 2011 17:45:20 +0000 (17:45 +0000)
Remove trailing whitespace

includes/resourceloader/ResourceLoader.php
includes/resourceloader/ResourceLoaderContext.php
includes/resourceloader/ResourceLoaderFileModule.php
includes/resourceloader/ResourceLoaderModule.php
includes/resourceloader/ResourceLoaderNoscriptModule.php
includes/resourceloader/ResourceLoaderSiteModule.php
includes/resourceloader/ResourceLoaderStartUpModule.php
includes/resourceloader/ResourceLoaderUserGroupsModule.php
includes/resourceloader/ResourceLoaderUserModule.php
includes/resourceloader/ResourceLoaderUserOptionsModule.php
includes/resourceloader/ResourceLoaderWikiModule.php

index ec11264..58e8028 100644 (file)
@@ -569,6 +569,8 @@ class ResourceLoader {
         * @param $messages Mixed: List of messages associated with this module. May either be an 
         *     associative array mapping message key to value, or a JSON-encoded message blob containing
         *     the same data, wrapped in an XmlJsCode object.
+        *
+        * @return string
         */
        public static function makeLoaderImplementScript( $name, $scripts, $styles, $messages ) {
                if ( is_string( $scripts ) ) {
@@ -591,6 +593,8 @@ class ResourceLoader {
         *
         * @param $messages Mixed: Either an associative array mapping message key to value, or a
         *     JSON-encoded message blob containing the same data, wrapped in an XmlJsCode object.
+        *
+        * @return string
         */
        public static function makeMessageSetScript( $messages ) {
                return Xml::encodeJsCall( 'mw.messages.set', array( (object)$messages ) );
@@ -601,6 +605,8 @@ class ResourceLoader {
         * single stylesheet with @media blocks.
         *
         * @param $styles Array: List of CSS strings keyed by media type
+        *
+        * @return string
         */
        public static function makeCombinedStyles( array $styles ) {
                $out = '';
@@ -630,6 +636,11 @@ class ResourceLoader {
         *
         *    - ResourceLoader::makeLoaderStateScript( array( $name => $state, ... ) ):
         *         Set the state of modules with the given names to the given states
+        *
+        * @param $name string
+        * @param $state
+        *
+        * @return string
         */
        public static function makeLoaderStateScript( $name, $state = null ) {
                if ( is_array( $name ) ) {
@@ -650,6 +661,8 @@ class ResourceLoader {
         * @param $dependencies Array: List of module names on which this module depends
         * @param $group String: Group which the module is in.
         * @param $script String: JavaScript code
+        *
+        * @return string
         */
        public static function makeCustomLoaderScript( $name, $version, $dependencies, $group, $script ) {
                $script = str_replace( "\n", "\n\t", trim( $script ) );
@@ -679,6 +692,8 @@ class ResourceLoader {
         * @param $version Integer: Module version number as a timestamp
         * @param $dependencies Array: List of module names on which this module depends
         * @param $group String: group which the module is in.
+        *
+        * @return string
         */
        public static function makeLoaderRegisterScript( $name, $version = null, 
                $dependencies = null, $group = null ) 
@@ -697,6 +712,8 @@ class ResourceLoader {
         * present.
         *
         * @param $script String: JavaScript code
+        *
+        * @return string
         */
        public static function makeLoaderConditionalScript( $script ) {
                $script = str_replace( "\n", "\n\t", trim( $script ) );
@@ -708,11 +725,13 @@ class ResourceLoader {
         * the given value.
         *
         * @param $configuration Array: List of configuration values keyed by variable name
+        *
+        * @return string
         */
        public static function makeConfigSetScript( array $configuration ) {
                return Xml::encodeJsCall( 'mw.config.set', array( $configuration ) );
        }
-       
+
        /**
         * Convert an array of module names to a packed query string.
         * 
@@ -730,7 +749,7 @@ class ResourceLoader {
                        $suffix = $pos === false ? $module : substr( $module, $pos + 1 );
                        $groups[$prefix][] = $suffix;
                }
-               
+
                $arr = array();
                foreach ( $groups as $prefix => $suffixes ) {
                        $p = $prefix === '' ? '' : $prefix . '.';
@@ -739,7 +758,7 @@ class ResourceLoader {
                $str = implode( '|', $arr );
                return str_replace( ".", "!", $str ); # bug 28840
        }
-       
+
        /**
         * Determine whether debug mode was requested
         * Order of priority is 1) request param, 2) cookie, 3) $wg setting
@@ -748,8 +767,9 @@ class ResourceLoader {
        public static function inDebugMode() {
                global $wgRequest, $wgResourceLoaderDebug;
                static $retval = null;
-               if ( !is_null( $retval ) )
+               if ( !is_null( $retval ) ) {
                        return $retval;
+               }
                return $retval = $wgRequest->getFuzzyBool( 'debug',
                        $wgRequest->getCookie( 'resourceLoaderDebug', '', $wgResourceLoaderDebug ) );
        }
index f81f7ca..9e52e3b 100644 (file)
@@ -99,18 +99,30 @@ class ResourceLoaderContext {
                return $retval;
        }
 
+       /**
+        * @return ResourceLoader
+        */
        public function getResourceLoader() {
                return $this->resourceLoader;
        }
-       
+
+       /**
+        * @return WebRequest
+        */
        public function getRequest() {
                return $this->request;
        }
 
+       /**
+        * @return array
+        */
        public function getModules() {
                return $this->modules;
        }
 
+       /**
+        * @return string
+        */
        public function getLanguage() {
                if ( $this->language === null ) {
                        global $wgLang;
@@ -122,6 +134,9 @@ class ResourceLoaderContext {
                return $this->language;
        }
 
+       /**
+        * @return string
+        */
        public function getDirection() {
                if ( $this->direction === null ) {
                        $this->direction = $this->request->getVal( 'dir' );
@@ -133,38 +148,65 @@ class ResourceLoaderContext {
                return $this->direction;
        }
 
+       /**
+        * @return string
+        */
        public function getSkin() {
                return $this->skin;
        }
 
+       /**
+        * @return string
+        */
        public function getUser() {
                return $this->user;
        }
 
+       /**
+        * @return bool
+        */
        public function getDebug() {
                return $this->debug;
        }
 
+       /**
+        * @return String
+        */
        public function getOnly() {
                return $this->only;
        }
 
+       /**
+        * @return String
+        */
        public function getVersion() {
                return $this->version;
        }
 
+       /**
+        * @return bool
+        */
        public function shouldIncludeScripts() {
                return is_null( $this->only ) || $this->only === 'scripts';
        }
 
+       /**
+        * @return bool
+        */
        public function shouldIncludeStyles() {
                return is_null( $this->only ) || $this->only === 'styles';
        }
 
+       /**
+        * @return bool
+        */
        public function shouldIncludeMessages() {
                return is_null( $this->only ) || $this->only === 'messages';
        }
 
+       /**
+        * @return string
+        */
        public function getHash() {
                if ( !isset( $this->hash ) ) {
                        $this->hash = implode( '|', array(
index 813b789..f7b959c 100644 (file)
@@ -292,7 +292,10 @@ class ResourceLoaderFileModule extends ResourceLoaderModule {
        public function getGroup() {
                return $this->group;
        }
-       
+
+       /**
+        * @return string
+        */
        public function getPosition() {
                return $this->position;
        }
@@ -375,10 +378,18 @@ class ResourceLoaderFileModule extends ResourceLoaderModule {
 
        /* Protected Methods */
 
+       /**
+        * @param $path string
+        * @return string
+        */
        protected function getLocalPath( $path ) {
                return "{$this->localBasePath}/$path";
        }
-       
+
+       /**
+        * @param $path string
+        * @return string
+        */
        protected function getRemotePath( $path ) {
                return "{$this->remoteBasePath}/$path";
        }
@@ -494,6 +505,9 @@ class ResourceLoaderFileModule extends ResourceLoaderModule {
         * 
         * @param $styles Array: List of media type/list of file paths pairs, to read, remap and
         * concetenate
+        *
+        * @param $flip bool
+        *
         * @return Array: List of concatenated and remapped CSS data from $styles, 
         *     keyed by media type
         */
@@ -521,6 +535,8 @@ class ResourceLoaderFileModule extends ResourceLoaderModule {
         * This method can be used as a callback for array_map()
         * 
         * @param $path String: File path of script file to read
+        * @param $flip bool
+        *
         * @return String: CSS data in script file
         */
        protected function readStyleFile( $path, $flip ) {      
index 7d611fb..0c8f434 100644 (file)
@@ -99,7 +99,7 @@ abstract class ResourceLoaderModule {
         * Set this module's origin. This is called by ResourceLodaer::register()
         * when registering the module. Other code should not call this.
         *
-        * @param $name Int origin
+        * @param $origin Int origin
         */
        public function setOrigin( $origin ) {
                $this->origin = $origin;
@@ -164,6 +164,8 @@ abstract class ResourceLoaderModule {
         * Where on the HTML page should this module's JS be loaded?
         * 'top': in the <head>
         * 'bottom': at the bottom of the <body>
+        *
+        * @return string
         */
        public function getPosition() {
                return 'bottom';
index 49ea6f1..28f629a 100644 (file)
@@ -30,7 +30,9 @@ class ResourceLoaderNoscriptModule extends ResourceLoaderWikiModule {
        /**
         * Gets list of pages used by this module.  Obviously, it makes absolutely no
         * sense to include JavaScript files here... :D
-        * 
+        *
+        * @param $context ResourceLoaderContext
+        *
         * @return Array: List of pages
         */
        protected function getPages( ResourceLoaderContext $context ) {
index 977d16b..2527a0a 100644 (file)
@@ -29,7 +29,9 @@ class ResourceLoaderSiteModule extends ResourceLoaderWikiModule {
 
        /**
         * Gets list of pages used by this module
-        * 
+        *
+        * @param $context ResourceLoaderContext
+        *
         * @return Array: List of pages
         */
        protected function getPages( ResourceLoaderContext $context ) {
index 29c4645..63971f9 100644 (file)
@@ -162,6 +162,10 @@ class ResourceLoaderStartUpModule extends ResourceLoaderModule {
 
        /* Methods */
 
+       /**
+        * @param $context ResourceLoaderContext
+        * @return string
+        */
        public function getScript( ResourceLoaderContext $context ) {
                global $IP, $wgLoadScript, $wgLegacyJavaScriptGlobals;
 
@@ -211,6 +215,10 @@ class ResourceLoaderStartUpModule extends ResourceLoaderModule {
                return $out;
        }
 
+       /**
+        * @param $context ResourceLoaderContext
+        * @return array|mixed
+        */
        public function getModifiedTime( ResourceLoaderContext $context ) {
                global $IP, $wgCacheEpoch;
 
@@ -235,9 +243,12 @@ class ResourceLoaderStartUpModule extends ResourceLoaderModule {
                }
                return $this->modifiedTime[$hash] = $time;
        }
-       
+
        /* Methods */
-       
+
+       /**
+        * @return string
+        */
        public function getGroup() {
                return 'startup';
        }
index e51d6c7..e364828 100644 (file)
@@ -26,6 +26,10 @@ class ResourceLoaderUserGroupsModule extends ResourceLoaderWikiModule {
        /* Protected Methods */
        protected $origin = self::ORIGIN_USER_SITEWIDE;
 
+       /**
+        * @param $context ResourceLoaderContext
+        * @return array
+        */
        protected function getPages( ResourceLoaderContext $context ) {
                if ( $context->getUser() ) {
                        $user = User::newFromName( $context->getUser() );
@@ -44,9 +48,12 @@ class ResourceLoaderUserGroupsModule extends ResourceLoaderWikiModule {
                }
                return array();
        }
-       
+
        /* Methods */
-       
+
+       /**
+        * @return string
+        */
        public function getGroup() {
                return 'user';
        }
index f2413fd..892e846 100644 (file)
@@ -28,6 +28,10 @@ class ResourceLoaderUserModule extends ResourceLoaderWikiModule {
        /* Protected Methods */
        protected $origin = self::ORIGIN_USER_INDIVIDUAL;
 
+       /**
+        * @param $context ResourceLoaderContext
+        * @return array
+        */
        protected function getPages( ResourceLoaderContext $context ) {
                if ( $context->getUser() ) {
                        $username = $context->getUser();
@@ -42,9 +46,12 @@ class ResourceLoaderUserModule extends ResourceLoaderWikiModule {
                }
                return array();
        }
-       
+
        /* Methods */
-       
+
+       /**
+        * @return string
+        */
        public function getGroup() {
                return 'user';
        }
index b1e80d5..7b600ea 100644 (file)
@@ -33,6 +33,10 @@ class ResourceLoaderUserOptionsModule extends ResourceLoaderModule {
 
        /* Methods */
 
+       /**
+        * @param $context ResourceLoaderContext
+        * @return array|int|Mixed
+        */
        public function getModifiedTime( ResourceLoaderContext $context ) {
                $hash = $context->getHash();
                if ( isset( $this->modifiedTime[$hash] ) ) {
@@ -66,11 +70,19 @@ class ResourceLoaderUserOptionsModule extends ResourceLoaderModule {
                }
        }
 
+       /**
+        * @param $context ResourceLoaderContext
+        * @return string
+        */
        public function getScript( ResourceLoaderContext $context ) {
                return Xml::encodeJsCall( 'mw.user.options.set', 
                        array( $this->contextUserOptions( $context ) ) );
        }
 
+       /**
+        * @param $context ResourceLoaderContext
+        * @return array
+        */
        public function getStyles( ResourceLoaderContext $context ) {
                global $wgAllowUserCssPrefs;
 
@@ -111,6 +123,9 @@ class ResourceLoaderUserOptionsModule extends ResourceLoaderModule {
                return array();
        }
 
+       /**
+        * @return string
+        */
        public function getGroup() {
                return 'private';
        }
index 4a0a157..8065d69 100644 (file)
@@ -66,6 +66,10 @@ abstract class ResourceLoaderWikiModule extends ResourceLoaderModule {
        
        /* Methods */
 
+       /**
+        * @param $context ResourceLoaderContext
+        * @return string
+        */
        public function getScript( ResourceLoaderContext $context ) {
                $scripts = '';
                foreach ( $this->getPages( $context ) as $titleText => $options ) {
@@ -87,6 +91,10 @@ abstract class ResourceLoaderWikiModule extends ResourceLoaderModule {
                return $scripts;
        }
 
+       /**
+        * @param $context ResourceLoaderContext
+        * @return array
+        */
        public function getStyles( ResourceLoaderContext $context ) {
                global $wgScriptPath;
                
@@ -119,6 +127,10 @@ abstract class ResourceLoaderWikiModule extends ResourceLoaderModule {
                return $styles;
        }
 
+       /**
+        * @param $context ResourceLoaderContext
+        * @return int|mixed
+        */
        public function getModifiedTime( ResourceLoaderContext $context ) {
                $modifiedTime = 1; // wfTimestamp() interprets 0 as "now"
                $mtimes = $this->getTitleMtimes( $context );
@@ -127,7 +139,11 @@ abstract class ResourceLoaderWikiModule extends ResourceLoaderModule {
                }
                return $modifiedTime;
        }
-       
+
+       /**
+        * @param $context ResourceLoaderContext
+        * @return bool
+        */
        public function isKnownEmpty( ResourceLoaderContext $context ) {
                return count( $this->getTitleMtimes( $context ) ) == 0;
        }