More return documentation and trimming trailing whitespace
authorSam Reed <reedy@users.mediawiki.org>
Thu, 30 Jun 2011 02:59:43 +0000 (02:59 +0000)
committerSam Reed <reedy@users.mediawiki.org>
Thu, 30 Jun 2011 02:59:43 +0000 (02:59 +0000)
includes/GlobalFunctions.php
includes/WebRequest.php
includes/specials/SpecialNewpages.php

index f3f646f..0ff0f98 100644 (file)
@@ -50,7 +50,7 @@ if( !function_exists( 'mb_strpos' ) ) {
        function mb_strpos( $haystack, $needle, $offset = 0, $encoding = '' ) {
                return Fallback::mb_strpos( $haystack, $needle, $offset, $encoding );
        }
-       
+
 }
 
 if( !function_exists( 'mb_strrpos' ) ) {
@@ -316,8 +316,8 @@ function wfUrlencode( $s ) {
  * "days=7&limit=100". Options in the first array override options in the second.
  * Options set to "" will not be output.
  *
- * @param $array1 Array( String|Array )
- * @param $array2 Array( String|Array )
+ * @param $array1 Array ( String|Array )
+ * @param $array2 Array ( String|Array )
  * @param $prefix String
  * @return String
  */
@@ -511,7 +511,7 @@ function wfParseUrl( $url ) {
        /* Provide an empty host for eg. file:/// urls (see bug 28627) */
        if ( !isset( $bits['host'] ) ) {
                $bits['host'] = '';
-               
+
                /* parse_url loses the third / for file:///c:/ urls (but not on variants) */
                if ( substr( $bits['path'], 0, 1 ) !== '/' ) {
                        $bits['path'] = '/' . $bits['path'];
@@ -623,10 +623,10 @@ function wfIsDebugRawPage() {
        }
        # Check for raw action using $_GET not $wgRequest, since the latter might not be initialised yet
        if ( ( isset( $_GET['action'] ) && $_GET['action'] == 'raw' )
-               || ( 
-                       isset( $_SERVER['SCRIPT_NAME'] ) 
-                       && substr( $_SERVER['SCRIPT_NAME'], -8 ) == 'load.php' 
-               ) )     
+               || (
+                       isset( $_SERVER['SCRIPT_NAME'] )
+                       && substr( $_SERVER['SCRIPT_NAME'], -8 ) == 'load.php'
+               ) )
        {
                $cache = true;
        } else {
@@ -637,7 +637,7 @@ function wfIsDebugRawPage() {
 
 /**
  * Get microsecond timestamps for debug logs
- * 
+ *
  * @return string
  */
 function wfDebugTimer() {
@@ -1277,7 +1277,7 @@ function wfDebugDieBacktrace( $msg = '' ) {
  * Fetch server name for use in error reporting etc.
  * Use real server name if available, so we know which machine
  * in a server farm generated the current page.
- * 
+ *
  * @return string
  */
 function wfHostname() {
@@ -2538,7 +2538,7 @@ function wfPercent( $nr, $acc = 2, $round = true ) {
 function in_string( $needle, $str, $insensitive = false ) {
        $func = 'strpos';
        if( $insensitive ) $func = 'stripos';
-       
+
        return $func( $str, $needle ) !== false;
 }
 
@@ -2996,11 +2996,11 @@ function wfSetupSession( $sessionId = false ) {
                        global $IP;
                        require_once( "$IP/includes/cache/MemcachedSessions.php" );
                }
-               session_set_save_handler( 'memsess_open', 'memsess_close', 'memsess_read', 
+               session_set_save_handler( 'memsess_open', 'memsess_close', 'memsess_read',
                        'memsess_write', 'memsess_destroy', 'memsess_gc' );
 
-               // It's necessary to register a shutdown function to call session_write_close(), 
-               // because by the time the request shutdown function for the session module is 
+               // It's necessary to register a shutdown function to call session_write_close(),
+               // because by the time the request shutdown function for the session module is
                // called, $wgMemc has already been destroyed. Shutdown functions registered
                // this way are called before object destruction.
                register_shutdown_function( 'memsess_write_close' );
@@ -3327,7 +3327,7 @@ function wfWarn( $msg, $callerOffset = 1, $level = E_USER_NOTICE ) {
  * master position. Use this when updating very large numbers of rows, as
  * in maintenance scripts, to avoid causing too much lag.  Of course, this is
  * a no-op if there are no slaves.
- * 
+ *
  * @param $maxLag Integer (deprecated)
  * @param $wiki mixed Wiki identifier accepted by wfGetLB
  * @return null
@@ -3477,7 +3477,7 @@ function wfBCP47( $code ) {
        $codeBCP = array();
        foreach ( $codeSegment as $segNo => $seg ) {
                if ( count( $codeSegment ) > 0 ) {
-                       // when previous segment is x, it is a private segment and should be lc 
+                       // when previous segment is x, it is a private segment and should be lc
                        if( $segNo > 0 && strtolower( $codeSegment[($segNo - 1)] ) == 'x') {
                                $codeBCP[$segNo] = strtolower( $seg );
                        // ISO 3166 country code
@@ -3551,9 +3551,9 @@ function wfRunHooks( $event, $args = array() ) {
 }
 
 /**
- * Unserialize a string to a PHP value without throwing E_NOTICE. Simply a 
+ * Unserialize a string to a PHP value without throwing E_NOTICE. Simply a
  * wrapper around unserialize()
- * 
+ *
  * @param $data string The serialized string
  * @return mixed
  */
index c4f66d5..621631b 100644 (file)
@@ -127,6 +127,8 @@ class WebRequest {
        /**
         * Work out an appropriate URL prefix containing scheme and host, based on
         * information detected from $_SERVER
+        *
+        * @return string
         */
        public static function detectServer() {
                if ( isset( $_SERVER['HTTPS'] ) && $_SERVER['HTTPS'] == 'on') {
@@ -196,7 +198,7 @@ class WebRequest {
         *             passed on as the value of this URL parameter
         * @return array of URL variables to interpolate; empty if no match
         */
-       private static function extractTitle( $path, $bases, $key=false ) {
+       private static function extractTitle( $path, $bases, $key = false ) {
                foreach( (array)$bases as $keyValue => $base ) {
                        // Find the part after $wgArticlePath
                        $base = str_replace( '$1', '', $base );
@@ -464,6 +466,8 @@ class WebRequest {
         * Extracts the given named values into an array.
         * If no arguments are given, returns all input values.
         * No transformation is performed on the values.
+        *
+        * @return array
         */
        public function getValues() {
                $names = func_get_args();
@@ -606,6 +610,12 @@ class WebRequest {
                return htmlspecialchars( $this->appendQuery( $query ) );
        }
 
+       /**
+        * @param $key
+        * @param $value
+        * @param $onlyquery bool
+        * @return String
+        */
        public function appendQueryValue( $key, $value, $onlyquery = false ) {
                return $this->appendQueryArray( array( $key => $value ), $onlyquery );
        }
@@ -714,7 +724,7 @@ class WebRequest {
        /**
         * Return a WebRequestUpload object corresponding to the key
         *
-        * @param @key string
+        * @param $key string
         * @return WebRequestUpload
         */
        public function getUpload( $key ) {
@@ -749,7 +759,6 @@ class WebRequest {
                                $this->headers[ strtoupper( $tempName ) ] = $tempValue;
                        }
                } else {
-                       $headers = $_SERVER;
                        foreach ( $_SERVER as $name => $value ) {
                                if ( substr( $name, 0, 5 ) === 'HTTP_' ) {
                                        $name = str_replace( '_', '-',  substr( $name, 5 ) );
@@ -774,6 +783,8 @@ class WebRequest {
        /**
         * Get a request header, or false if it isn't set
         * @param $name String: case-insensitive header name
+        *
+        * @return string|false
         */
        public function getHeader( $name ) {
                $this->initHeaders();
@@ -813,6 +824,9 @@ class WebRequest {
         * PATH_INFO or QUERY_STRING. If the request can't be allowed, show an error
         * message or redirect to a safer URL. Returns true if the URL is OK, and
         * false if an error message has been shown and the request should be aborted.
+        *
+        * @param $extWhitelist array
+        * @return bool
         */
        public function checkUrlExtension( $extWhitelist = array() ) {
                global $wgScriptExtension;
@@ -837,6 +851,9 @@ class WebRequest {
        /**
         * Attempt to redirect to a URL with a QUERY_STRING that's not dangerous in
         * IE 6. Returns true if it was successful, false otherwise.
+        *
+        * @param $url string
+        * @return bool
         */
        protected function doSecurityRedirect( $url ) {
                header( 'Location: ' . $url );
index 7b96222..a86b9a4 100644 (file)
@@ -440,7 +440,7 @@ class SpecialNewpages extends IncludableSpecialPage {
                $revision = Revision::newFromId( $row->rev_id );
                if( $revision ) {
                        return '<p>' . htmlspecialchars( $revision->getUserText() ) . wfMsgForContent( 'colon-separator' ) .
-                               htmlspecialchars( FeedItem::stripComment( $revision->getComment() ) ) . 
+                               htmlspecialchars( FeedItem::stripComment( $revision->getComment() ) ) .
                                "</p>\n<hr />\n<div>" .
                                nl2br( htmlspecialchars( $revision->getText() ) ) . "</div>";
                }
@@ -453,7 +453,12 @@ class SpecialNewpages extends IncludableSpecialPage {
  */
 class NewPagesPager extends ReverseChronologicalPager {
        // Stored opts
-       protected $opts, $mForm;
+       protected $opts;
+
+       /**
+        * @var HtmlForm
+        */
+       protected $mForm;
 
        function __construct( $form, FormOptions $opts ) {
                parent::__construct();
@@ -461,6 +466,9 @@ class NewPagesPager extends ReverseChronologicalPager {
                $this->opts = $opts;
        }
 
+       /**
+        * @return Title
+        */
        function getTitle() {
                static $title = null;
                if ( $title === null ) {
@@ -469,6 +477,9 @@ class NewPagesPager extends ReverseChronologicalPager {
                return $title;
        }
 
+       /**
+        * @return User
+        */
        function getUser() {
                static $user = null;
                if ( $user === null ) {
@@ -514,7 +525,7 @@ class NewPagesPager extends ReverseChronologicalPager {
                if ( $this->opts->getValue( 'hideredirs' ) ) {
                        $conds['page_is_redirect'] = 0;
                }
-  
+
                // Allow changes to the New Pages query
                $tables = array( 'recentchanges', 'page' );
                $fields = array(