Type hinting
authorSam Reed <reedy@users.mediawiki.org>
Mon, 25 Apr 2011 21:25:45 +0000 (21:25 +0000)
committerSam Reed <reedy@users.mediawiki.org>
Mon, 25 Apr 2011 21:25:45 +0000 (21:25 +0000)
Braces

Remove extra whitespace

includes/BacklinkCache.php
includes/GenderCache.php
includes/HTMLFileCache.php
includes/ProxyTools.php
includes/TitleArray.php
maintenance/importImages.inc

index 0ebbdc3..6715d25 100644 (file)
@@ -114,7 +114,7 @@ class BacklinkCache {
         * @param $table String
         * @param $startId Integer or false
         * @param $endId Integer or false
-        * @return TitleArray
+        * @return TitleArrayFromResult
         */
        public function getLinks( $table, $startId = false, $endId = false ) {
                wfProfileIn( __METHOD__ );
@@ -272,7 +272,6 @@ class BacklinkCache {
                $this->partitionCache[$table][$batchSize] = false;
                $cacheEntry =& $this->partitionCache[$table][$batchSize];
 
-
                // 2) try full result cache
 
                if ( isset( $this->fullResultCache[$table] ) ) {
@@ -282,7 +281,6 @@ class BacklinkCache {
                        return $cacheEntry['batches'];
                }
 
-
                // 3) ... fallback to memcached ...
 
                global $wgMemc;
@@ -317,7 +315,7 @@ class BacklinkCache {
 
        /**
         * Partition a DB result with backlinks in it into batches
-        * @param $res database result
+        * @param $res ResultWrapper database result
         * @param $batchSize integer
         * @return array @see 
         */
index f7537a2..a8b32cc 100644 (file)
@@ -91,7 +91,9 @@ class GenderCache {
         * @param $caller String: the calling method
         */
        public function doQuery( $users, $caller = '' ) {
-               if ( count( $users ) === 0 ) return false;
+               if ( count( $users ) === 0 ) {
+                       return false;
+               }
 
                foreach ( (array) $users as $index => $value ) {
                        $users[$index] = strtr( $value, '_', ' ' );
index 20224b0..949ed36 100644 (file)
@@ -69,7 +69,9 @@ class HTMLFileCache {
        }
 
        public function isFileCached() {
-               if( $this->mType === false ) return false;
+               if( $this->mType === false ) {
+                       return false;
+               }
                return file_exists( $this->fileCacheName() );
        }
 
@@ -83,20 +85,28 @@ class HTMLFileCache {
         */
        public static function useFileCache() {
                global $wgUser, $wgUseFileCache, $wgShowIPinHeader, $wgRequest, $wgLang, $wgContLang;
-               if( !$wgUseFileCache ) return false;
+               if( !$wgUseFileCache ) {
+                       return false;
+               }
                // Get all query values
                $queryVals = $wgRequest->getValues();
                foreach( $queryVals as $query => $val ) {
-                       if( $query == 'title' || $query == 'curid' ) continue;
+                       if( $query == 'title' || $query == 'curid' ) {
+                               continue;
+                       }
                        // Normal page view in query form can have action=view.
                        // Raw hits for pages also stored, like .css pages for example.
-                       else if( $query == 'action' && ($val == 'view' || $val == 'raw') ) continue;
-                       else if( $query == 'usemsgcache' && $val == 'yes' ) continue;
+                       else if( $query == 'action' && ($val == 'view' || $val == 'raw') ) {
+                               continue;
+                       } else if( $query == 'usemsgcache' && $val == 'yes' ) {
+                               continue;
+                       }
                        // Below are header setting params
-                       else if( $query == 'maxage' || $query == 'smaxage' || $query == 'ctype' || $query == 'gen' )
+                       else if( $query == 'maxage' || $query == 'smaxage' || $query == 'ctype' || $query == 'gen' ) {
                                continue;
-                       else
+                       } else {
                                return false;
+                       }
                }
                // Check for non-standard user language; this covers uselang,
                // and extensions for auto-detecting user language.
@@ -113,7 +123,9 @@ class HTMLFileCache {
        public function isFileCacheGood( $timestamp = '' ) {
                global $wgCacheEpoch;
 
-               if( !$this->isFileCached() ) return false;
+               if( !$this->isFileCached() ) {
+                       return false;
+               }
 
                $cachetime = $this->fileCacheTime();
                $good = $timestamp <= $cachetime && $wgCacheEpoch <= $cachetime;
index c09403a..c45caf0 100644 (file)
@@ -15,7 +15,7 @@ function wfGetForwardedFor() {
        $apacheHeaders = function_exists( 'apache_request_headers' ) ? apache_request_headers() : null;
        if( is_array( $apacheHeaders ) ) {
                // More reliable than $_SERVER due to case and -/_ folding
-               $set = array ();
+               $set = array();
                foreach ( $apacheHeaders as $tempName => $tempValue ) {
                        $set[ strtoupper( $tempName ) ] = $tempValue;
                }
@@ -46,7 +46,7 @@ function wfGetForwardedFor() {
 function wfGetAgent() {
        if( function_exists( 'apache_request_headers' ) ) {
                // More reliable than $_SERVER due to case and -/_ folding
-               $set = array ();
+               $set = array();
                foreach ( apache_request_headers() as $tempName => $tempValue ) {
                        $set[ strtoupper( $tempName ) ] = $tempValue;
                }
@@ -134,13 +134,8 @@ function wfGetIP() {
 function wfIsTrustedProxy( $ip ) {
        global $wgSquidServers, $wgSquidServersNoPurge;
 
-       if ( in_array( $ip, $wgSquidServers ) ||
-               in_array( $ip, $wgSquidServersNoPurge )
-       ) {
-               $trusted = true;
-       } else {
-               $trusted = false;
-       }
+       $trusted = in_array( $ip, $wgSquidServers ) ||
+               in_array( $ip, $wgSquidServersNoPurge );
        wfRunHooks( 'IsTrustedProxy', array( &$ip, &$trusted ) );
        return $trusted;
 }
index f7a9e1d..7274a19 100644 (file)
@@ -14,7 +14,7 @@ abstract class TitleArray implements Iterator {
         * @param $res result A MySQL result including at least page_namespace and
         *   page_title -- also can have page_id, page_len, page_is_redirect,
         *   page_latest (if those will be used).  See Title::newFromRow.
-        * @return TitleArray
+        * @return TitleArrayFromResult
         */
        static function newFromResult( $res ) {
                $array = null;
@@ -27,6 +27,10 @@ abstract class TitleArray implements Iterator {
                return $array;
        }
 
+       /**
+        * @param $res
+        * @return TitleArrayFromResult
+        */
        protected static function newFromResult_internal( $res ) {
                $array = new TitleArrayFromResult( $res );
                return $array;
index 8c4bdc0..5d35e2c 100644 (file)
@@ -54,7 +54,7 @@ function findFiles( $dir, $exts ) {
 /**
  * Split a filename into filename and extension
  *
- * @param $filename Filename
+ * @param $filename string Filename
  * @return array
  */
 function splitFilename( $filename ) {