http://www.mediawiki.org/wiki/Special:Code/MediaWiki/88524

Revision: 88524
Author:   reedy
Date:     2011-05-21 17:45:20 +0000 (Sat, 21 May 2011)
Log Message:
-----------
Fixup/add documentation

Remove trailing whitespace

Modified Paths:
--------------
    trunk/phase3/includes/resourceloader/ResourceLoader.php
    trunk/phase3/includes/resourceloader/ResourceLoaderContext.php
    trunk/phase3/includes/resourceloader/ResourceLoaderFileModule.php
    trunk/phase3/includes/resourceloader/ResourceLoaderModule.php
    trunk/phase3/includes/resourceloader/ResourceLoaderNoscriptModule.php
    trunk/phase3/includes/resourceloader/ResourceLoaderSiteModule.php
    trunk/phase3/includes/resourceloader/ResourceLoaderStartUpModule.php
    trunk/phase3/includes/resourceloader/ResourceLoaderUserGroupsModule.php
    trunk/phase3/includes/resourceloader/ResourceLoaderUserModule.php
    trunk/phase3/includes/resourceloader/ResourceLoaderUserOptionsModule.php
    trunk/phase3/includes/resourceloader/ResourceLoaderWikiModule.php

Modified: trunk/phase3/includes/resourceloader/ResourceLoader.php
===================================================================
--- trunk/phase3/includes/resourceloader/ResourceLoader.php     2011-05-21 
17:20:12 UTC (rev 88523)
+++ trunk/phase3/includes/resourceloader/ResourceLoader.php     2011-05-21 
17:45:20 UTC (rev 88524)
@@ -569,6 +569,8 @@
         * @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 @@
         *
         * @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 @@
         * 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 @@
         *
         *    - 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 @@
         * @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 @@
         * @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 @@
         * 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 @@
         * 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 @@
                        $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 @@
                $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 @@
        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 ) );
        }

Modified: trunk/phase3/includes/resourceloader/ResourceLoaderContext.php
===================================================================
--- trunk/phase3/includes/resourceloader/ResourceLoaderContext.php      
2011-05-21 17:20:12 UTC (rev 88523)
+++ trunk/phase3/includes/resourceloader/ResourceLoaderContext.php      
2011-05-21 17:45:20 UTC (rev 88524)
@@ -99,18 +99,30 @@
                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 @@
                return $this->language;
        }
 
+       /**
+        * @return string
+        */
        public function getDirection() {
                if ( $this->direction === null ) {
                        $this->direction = $this->request->getVal( 'dir' );
@@ -133,38 +148,65 @@
                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(

Modified: trunk/phase3/includes/resourceloader/ResourceLoaderFileModule.php
===================================================================
--- trunk/phase3/includes/resourceloader/ResourceLoaderFileModule.php   
2011-05-21 17:20:12 UTC (rev 88523)
+++ trunk/phase3/includes/resourceloader/ResourceLoaderFileModule.php   
2011-05-21 17:45:20 UTC (rev 88524)
@@ -292,7 +292,10 @@
        public function getGroup() {
                return $this->group;
        }
-       
+
+       /**
+        * @return string
+        */
        public function getPosition() {
                return $this->position;
        }
@@ -375,10 +378,18 @@
 
        /* 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 @@
         * 
         * @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 @@
         * 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 ) {      

Modified: trunk/phase3/includes/resourceloader/ResourceLoaderModule.php
===================================================================
--- trunk/phase3/includes/resourceloader/ResourceLoaderModule.php       
2011-05-21 17:20:12 UTC (rev 88523)
+++ trunk/phase3/includes/resourceloader/ResourceLoaderModule.php       
2011-05-21 17:45:20 UTC (rev 88524)
@@ -99,7 +99,7 @@
         * 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 @@
         * 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';

Modified: trunk/phase3/includes/resourceloader/ResourceLoaderNoscriptModule.php
===================================================================
--- trunk/phase3/includes/resourceloader/ResourceLoaderNoscriptModule.php       
2011-05-21 17:20:12 UTC (rev 88523)
+++ trunk/phase3/includes/resourceloader/ResourceLoaderNoscriptModule.php       
2011-05-21 17:45:20 UTC (rev 88524)
@@ -30,7 +30,9 @@
        /**
         * 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 ) {

Modified: trunk/phase3/includes/resourceloader/ResourceLoaderSiteModule.php
===================================================================
--- trunk/phase3/includes/resourceloader/ResourceLoaderSiteModule.php   
2011-05-21 17:20:12 UTC (rev 88523)
+++ trunk/phase3/includes/resourceloader/ResourceLoaderSiteModule.php   
2011-05-21 17:45:20 UTC (rev 88524)
@@ -29,7 +29,9 @@
 
        /**
         * Gets list of pages used by this module
-        * 
+        *
+        * @param $context ResourceLoaderContext
+        *
         * @return Array: List of pages
         */
        protected function getPages( ResourceLoaderContext $context ) {

Modified: trunk/phase3/includes/resourceloader/ResourceLoaderStartUpModule.php
===================================================================
--- trunk/phase3/includes/resourceloader/ResourceLoaderStartUpModule.php        
2011-05-21 17:20:12 UTC (rev 88523)
+++ trunk/phase3/includes/resourceloader/ResourceLoaderStartUpModule.php        
2011-05-21 17:45:20 UTC (rev 88524)
@@ -162,6 +162,10 @@
 
        /* Methods */
 
+       /**
+        * @param $context ResourceLoaderContext
+        * @return string
+        */
        public function getScript( ResourceLoaderContext $context ) {
                global $IP, $wgLoadScript, $wgLegacyJavaScriptGlobals;
 
@@ -211,6 +215,10 @@
                return $out;
        }
 
+       /**
+        * @param $context ResourceLoaderContext
+        * @return array|mixed
+        */
        public function getModifiedTime( ResourceLoaderContext $context ) {
                global $IP, $wgCacheEpoch;
 
@@ -235,9 +243,12 @@
                }
                return $this->modifiedTime[$hash] = $time;
        }
-       
+
        /* Methods */
-       
+
+       /**
+        * @return string
+        */
        public function getGroup() {
                return 'startup';
        }

Modified: 
trunk/phase3/includes/resourceloader/ResourceLoaderUserGroupsModule.php
===================================================================
--- trunk/phase3/includes/resourceloader/ResourceLoaderUserGroupsModule.php     
2011-05-21 17:20:12 UTC (rev 88523)
+++ trunk/phase3/includes/resourceloader/ResourceLoaderUserGroupsModule.php     
2011-05-21 17:45:20 UTC (rev 88524)
@@ -26,6 +26,10 @@
        /* 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 @@
                }
                return array();
        }
-       
+
        /* Methods */
-       
+
+       /**
+        * @return string
+        */
        public function getGroup() {
                return 'user';
        }

Modified: trunk/phase3/includes/resourceloader/ResourceLoaderUserModule.php
===================================================================
--- trunk/phase3/includes/resourceloader/ResourceLoaderUserModule.php   
2011-05-21 17:20:12 UTC (rev 88523)
+++ trunk/phase3/includes/resourceloader/ResourceLoaderUserModule.php   
2011-05-21 17:45:20 UTC (rev 88524)
@@ -28,6 +28,10 @@
        /* 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 @@
                }
                return array();
        }
-       
+
        /* Methods */
-       
+
+       /**
+        * @return string
+        */
        public function getGroup() {
                return 'user';
        }

Modified: 
trunk/phase3/includes/resourceloader/ResourceLoaderUserOptionsModule.php
===================================================================
--- trunk/phase3/includes/resourceloader/ResourceLoaderUserOptionsModule.php    
2011-05-21 17:20:12 UTC (rev 88523)
+++ trunk/phase3/includes/resourceloader/ResourceLoaderUserOptionsModule.php    
2011-05-21 17:45:20 UTC (rev 88524)
@@ -33,6 +33,10 @@
 
        /* 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 @@
                }
        }
 
+       /**
+        * @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 @@
                return array();
        }
 
+       /**
+        * @return string
+        */
        public function getGroup() {
                return 'private';
        }

Modified: trunk/phase3/includes/resourceloader/ResourceLoaderWikiModule.php
===================================================================
--- trunk/phase3/includes/resourceloader/ResourceLoaderWikiModule.php   
2011-05-21 17:20:12 UTC (rev 88523)
+++ trunk/phase3/includes/resourceloader/ResourceLoaderWikiModule.php   
2011-05-21 17:45:20 UTC (rev 88524)
@@ -66,6 +66,10 @@
        
        /* Methods */
 
+       /**
+        * @param $context ResourceLoaderContext
+        * @return string
+        */
        public function getScript( ResourceLoaderContext $context ) {
                $scripts = '';
                foreach ( $this->getPages( $context ) as $titleText => $options 
) {
@@ -87,6 +91,10 @@
                return $scripts;
        }
 
+       /**
+        * @param $context ResourceLoaderContext
+        * @return array
+        */
        public function getStyles( ResourceLoaderContext $context ) {
                global $wgScriptPath;
                
@@ -119,6 +127,10 @@
                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 @@
                }
                return $modifiedTime;
        }
-       
+
+       /**
+        * @param $context ResourceLoaderContext
+        * @return bool
+        */
        public function isKnownEmpty( ResourceLoaderContext $context ) {
                return count( $this->getTitleMtimes( $context ) ) == 0;
        }


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to