More parameter documentation!!
authorSam Reed <reedy@users.mediawiki.org>
Sat, 28 May 2011 15:59:57 +0000 (15:59 +0000)
committerSam Reed <reedy@users.mediawiki.org>
Sat, 28 May 2011 15:59:57 +0000 (15:59 +0000)
includes/HttpFunctions.old.php
includes/TitleArray.php
includes/UserArray.php
includes/cache/CacheDependency.php
includes/objectcache/BagOStuff.php
includes/objectcache/MemcachedPhpBagOStuff.php
includes/parser/Tidy.php

index 6d28abc..ddfa608 100644 (file)
@@ -7,6 +7,7 @@
  * http://www.php.net/manual/en/class.httprequest.php
  *
  * This is for backwards compatibility.
+ * @since 1.17
  */
 
 class HttpRequest extends MWHttpRequest { }
index 7274a19..9696008 100644 (file)
@@ -11,7 +11,7 @@
  */
 abstract class TitleArray implements Iterator {
        /**
-        * @param $res result A MySQL result including at least page_namespace and
+        * @param $res ResultWrapper A SQL 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 TitleArrayFromResult
@@ -28,7 +28,7 @@ abstract class TitleArray implements Iterator {
        }
 
        /**
-        * @param $res
+        * @param $res ResultWrapper
         * @return TitleArrayFromResult
         */
        protected static function newFromResult_internal( $res ) {
@@ -38,6 +38,10 @@ abstract class TitleArray implements Iterator {
 }
 
 class TitleArrayFromResult extends TitleArray {
+
+       /**
+        * @var ResultWrapper
+        */
        var $res;
        var $key, $current;
 
@@ -47,6 +51,10 @@ class TitleArrayFromResult extends TitleArray {
                $this->setCurrent( $this->res->current() );
        }
 
+       /**
+        * @param $row ResultWrapper
+        * @return void
+        */
        protected function setCurrent( $row ) {
                if ( $row === false ) {
                        $this->current = false;
@@ -55,6 +63,9 @@ class TitleArrayFromResult extends TitleArray {
                }
        }
 
+       /**
+        * @return int
+        */
        public function count() {
                return $this->res->numRows();
        }
@@ -79,6 +90,9 @@ class TitleArrayFromResult extends TitleArray {
                $this->setCurrent( $this->res->current() );
        }
 
+       /**
+        * @return bool
+        */
        function valid() {
                return $this->current !== false;
        }
index a69df41..6cce48c 100644 (file)
@@ -1,9 +1,8 @@
 <?php
 
 abstract class UserArray implements Iterator {
-
        /**
-        * @param $res
+        * @param $res ResultWrapper
         * @return UserArrayFromResult
         */
        static function newFromResult( $res ) {
@@ -33,22 +32,36 @@ abstract class UserArray implements Iterator {
                return self::newFromResult( $res );
        }
 
+       /**
+        * @param $res
+        * @return UserArrayFromResult
+        */
        protected static function newFromResult_internal( $res ) {
-               $userArray = new UserArrayFromResult( $res );
-               return $userArray;
+               return new UserArrayFromResult( $res );
        }
 }
 
 class UserArrayFromResult extends UserArray {
+
+       /**
+        * @var ResultWrapper
+        */
        var $res;
        var $key, $current;
 
+       /**
+        * @param $res ResultWrapper
+        */
        function __construct( $res ) {
                $this->res = $res;
                $this->key = 0;
                $this->setCurrent( $this->res->current() );
        }
 
+       /**
+        * @param  $row
+        * @return void
+        */
        protected function setCurrent( $row ) {
                if ( $row === false ) {
                        $this->current = false;
@@ -57,6 +70,9 @@ class UserArrayFromResult extends UserArray {
                }
        }
 
+       /**
+        * @return int
+        */
        public function count() {
                return $this->res->numRows();
        }
@@ -81,6 +97,9 @@ class UserArrayFromResult extends UserArray {
                $this->setCurrent( $this->res->current() );
        }
 
+       /**
+        * @return bool
+        */
        function valid() {
                return $this->current !== false;
        }
index 74ca286..aa02066 100644 (file)
@@ -58,6 +58,10 @@ class DependencyWrapper {
 
        /**
         * Store the wrapper to a cache
+        *
+        * @param $cache BagOStuff
+        * @param $key
+        * @param $expiry
         */
        function storeToCache( $cache, $key, $expiry = 0 ) {
                $this->initialiseDeps();
@@ -69,7 +73,7 @@ class DependencyWrapper {
         * it will be generated with the callback function (if present), and the newly
         * calculated value will be stored to the cache in a wrapper.
         *
-        * @param $cache Object: a cache object such as $wgMemc
+        * @param $cache BagOStuff a cache object such as $wgMemc
         * @param $key String: the cache key
         * @param $expiry Integer: the expiry timestamp or interval in seconds
         * @param $callback Mixed: the callback for generating the value, or false
@@ -156,6 +160,9 @@ class FileDependency extends CacheDependency {
                }
        }
 
+       /**
+        * @return bool
+        */
        function isExpired() {
                if ( !file_exists( $this->filename ) ) {
                        if ( $this->timestamp === false ) {
@@ -204,11 +211,16 @@ class TitleDependency extends CacheDependency {
 
        /**
         * Get rid of bulky Title object for sleep
+        *
+        * @return array
         */
        function __sleep() {
                return array( 'ns', 'dbk', 'touched' );
        }
 
+       /**
+        * @return Title
+        */
        function getTitle() {
                if ( !isset( $this->titleObj ) ) {
                        $this->titleObj = Title::makeTitle( $this->ns, $this->dbk );
@@ -217,6 +229,9 @@ class TitleDependency extends CacheDependency {
                return $this->titleObj;
        }
 
+       /**
+        * @return bool
+        */
        function isExpired() {
                $touched = $this->getTitle()->getTouched();
 
@@ -292,6 +307,9 @@ class TitleListDependency extends CacheDependency {
                $this->timestamps = $this->calculateTimestamps();
        }
 
+       /**
+        * @return array
+        */
        function __sleep() {
                return array( 'timestamps' );
        }
@@ -304,6 +322,9 @@ class TitleListDependency extends CacheDependency {
                return $this->linkBatch;
        }
 
+       /**
+        * @return bool
+        */
        function isExpired() {
                $newTimestamps = $this->calculateTimestamps();
 
@@ -345,6 +366,9 @@ class GlobalDependency extends CacheDependency {
                $this->value = $GLOBALS[$name];
        }
 
+       /**
+        * @return bool
+        */
        function isExpired() {
                return $GLOBALS[$this->name] != $this->value;
        }
@@ -361,6 +385,9 @@ class ConstantDependency extends CacheDependency {
                $this->value = constant( $name );
        }
 
+       /**
+        * @return bool
+        */
        function isExpired() {
                return constant( $this->name ) != $this->value;
        }
index fd0f621..634eff3 100644 (file)
@@ -43,6 +43,9 @@
 abstract class BagOStuff {
        private $debugMode = false;
 
+       /**
+        * @param $bool bool
+        */
        public function setDebug( $bool ) {
                $this->debugMode = $bool;
        }
@@ -53,6 +56,8 @@ abstract class BagOStuff {
        /**
         * Get an item with the given key. Returns false if it does not exist.
         * @param $key string
+        *
+        * @return bool|Object
         */
        abstract public function get( $key );
 
index 17d1292..1401668 100644 (file)
@@ -21,7 +21,7 @@ class MemcachedPhpBagOStuff extends BagOStuff {
         *   - timeout:             The read timeout in microseconds
         *   - connect_timeout:     The connect timeout in seconds
         *
-        * @params $params array
+        * @param $params array
         */
        function __construct( $params ) {
                if ( !isset( $params['servers'] ) ) {
@@ -48,42 +48,90 @@ class MemcachedPhpBagOStuff extends BagOStuff {
                $this->client->set_debug( $params['debug'] );
        }
 
+       /**
+        * @param $debug bool
+        */
        public function setDebug( $debug ) {
                $this->client->set_debug( $debug );
        }
 
+       /**
+        * @param $key string
+        * @return Mixed
+        */
        public function get( $key ) {
                return $this->client->get( $this->encodeKey( $key ) );
        }
-       
+
+       /**
+        * @param $key string
+        * @param $value
+        * @param $exptime int
+        * @return bool
+        */
        public function set( $key, $value, $exptime = 0 ) {
                return $this->client->set( $this->encodeKey( $key ), $value, $exptime );
        }
 
+       /**
+        * @param $key string
+        * @param $time int
+        * @return bool
+        */
        public function delete( $key, $time = 0 ) {
                return $this->client->delete( $this->encodeKey( $key ), $time );
        }
 
+       /**
+        * @param $key
+        * @param $timeout int
+        * @return
+        */
        public function lock( $key, $timeout = 0 ) {
                return $this->client->lock( $this->encodeKey( $key ), $timeout );
        }
 
+       /**
+        * @param $key string
+        * @return Mixed
+        */
        public function unlock( $key ) {
                return $this->client->unlock( $this->encodeKey( $key ) );
        }
 
+       /**
+        * @param $key string
+        * @param $value int
+        * @return Mixed
+        */
        public function add( $key, $value, $exptime = 0 ) {
                return $this->client->add( $this->encodeKey( $key ), $value, $exptime );
        }
 
+       /**
+        * @param $key string
+        * @param $value int
+        * @param $exptime
+        * @return Mixed
+        */
        public function replace( $key, $value, $exptime = 0 ) {
                return $this->client->replace( $this->encodeKey( $key ), $value, $exptime );
        }
 
+       /**
+        * @param $key string
+        * @param $value int
+        * @return Mixed
+        */
        public function incr( $key, $value = 1 ) {
                return $this->client->incr( $this->encodeKey( $key ), $value );
        }
 
+       /**
+        * @param $key string
+        * @param $value int
+        * @return Mixed
+        */
        public function decr( $key, $value = 1 ) {
                return $this->client->decr( $this->encodeKey( $key ), $value );
        }
@@ -91,6 +139,8 @@ class MemcachedPhpBagOStuff extends BagOStuff {
        /**
         * Get the underlying client object. This is provided for debugging 
         * purposes.
+        *
+        * @return MemCachedClientforWiki
         */
        public function getClient() {
                return $this->client;
@@ -116,6 +166,10 @@ class MemcachedPhpBagOStuff extends BagOStuff {
        /**
         * Decode a key encoded with encodeKey(). This is provided as a convenience 
         * function for debugging.
+        *
+        * @param $key string
+        *
+        * @return string
         */
        public function decodeKey( $key ) {
                return urldecode( $key );
index a745eac..e434db7 100644 (file)
  */
 class MWTidyWrapper {
 
-       protected $mTokens, $mUniqPrefix;
+       /**
+        * @var ReplacementArray
+        */
+       protected $mTokens;
+
+       protected $mUniqPrefix;
+
+       protected $mMarkerIndex;
 
        public function __construct() {
                $this->mTokens = null;
                $this->mUniqPrefix = null;
        }
 
+       /**
+        * @param $text string
+        * @return string
+        */
        public function getWrapped( $text ) {
                $this->mTokens = new ReplacementArray;
                $this->mUniqPrefix = "\x7fUNIQ" .
@@ -40,7 +51,9 @@ class MWTidyWrapper {
        }
 
        /**
-        * @private
+        * @param $m array
+        *
+        * @return string
         */
        function replaceEditSectionLinksCallback( $m ) {
                $marker = "{$this->mUniqPrefix}-item-{$this->mMarkerIndex}" . Parser::MARKER_SUFFIX;
@@ -49,6 +62,10 @@ class MWTidyWrapper {
                return $marker;
        }
 
+       /**
+        * @param $text string
+        * @return string
+        */
        public function postprocess( $text ) {
                return $this->mTokens->replace( $text );
        }
@@ -187,6 +204,12 @@ class MWTidy {
         * saving the overhead of spawning a new process.
         *
         * 'pear install tidy' should be able to compile the extension module.
+        *
+        * @param $text
+        * @param $stderr
+        * @param $retval
+        *
+        * @return string
         */
        private static function execInternalTidy( $text, $stderr = false, &$retval = null ) {
                global $wgTidyConf, $wgDebugTidy;