http://www.mediawiki.org/wiki/Special:Code/MediaWiki/89040
Revision: 89040
Author: reedy
Date: 2011-05-28 15:59:57 +0000 (Sat, 28 May 2011)
Log Message:
-----------
More parameter documentation!!
Modified Paths:
--------------
trunk/phase3/includes/HttpFunctions.old.php
trunk/phase3/includes/TitleArray.php
trunk/phase3/includes/UserArray.php
trunk/phase3/includes/cache/CacheDependency.php
trunk/phase3/includes/objectcache/BagOStuff.php
trunk/phase3/includes/objectcache/MemcachedPhpBagOStuff.php
trunk/phase3/includes/parser/Tidy.php
Modified: trunk/phase3/includes/HttpFunctions.old.php
===================================================================
--- trunk/phase3/includes/HttpFunctions.old.php 2011-05-28 15:11:39 UTC (rev
89039)
+++ trunk/phase3/includes/HttpFunctions.old.php 2011-05-28 15:59:57 UTC (rev
89040)
@@ -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 { }
Modified: trunk/phase3/includes/TitleArray.php
===================================================================
--- trunk/phase3/includes/TitleArray.php 2011-05-28 15:11:39 UTC (rev
89039)
+++ trunk/phase3/includes/TitleArray.php 2011-05-28 15:59:57 UTC (rev
89040)
@@ -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 @@
}
/**
- * @param $res
+ * @param $res ResultWrapper
* @return TitleArrayFromResult
*/
protected static function newFromResult_internal( $res ) {
@@ -38,6 +38,10 @@
}
class TitleArrayFromResult extends TitleArray {
+
+ /**
+ * @var ResultWrapper
+ */
var $res;
var $key, $current;
@@ -47,6 +51,10 @@
$this->setCurrent( $this->res->current() );
}
+ /**
+ * @param $row ResultWrapper
+ * @return void
+ */
protected function setCurrent( $row ) {
if ( $row === false ) {
$this->current = false;
@@ -55,6 +63,9 @@
}
}
+ /**
+ * @return int
+ */
public function count() {
return $this->res->numRows();
}
@@ -79,6 +90,9 @@
$this->setCurrent( $this->res->current() );
}
+ /**
+ * @return bool
+ */
function valid() {
return $this->current !== false;
}
Modified: trunk/phase3/includes/UserArray.php
===================================================================
--- trunk/phase3/includes/UserArray.php 2011-05-28 15:11:39 UTC (rev 89039)
+++ trunk/phase3/includes/UserArray.php 2011-05-28 15:59:57 UTC (rev 89040)
@@ -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 @@
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 @@
}
}
+ /**
+ * @return int
+ */
public function count() {
return $this->res->numRows();
}
@@ -81,6 +97,9 @@
$this->setCurrent( $this->res->current() );
}
+ /**
+ * @return bool
+ */
function valid() {
return $this->current !== false;
}
Modified: trunk/phase3/includes/cache/CacheDependency.php
===================================================================
--- trunk/phase3/includes/cache/CacheDependency.php 2011-05-28 15:11:39 UTC
(rev 89039)
+++ trunk/phase3/includes/cache/CacheDependency.php 2011-05-28 15:59:57 UTC
(rev 89040)
@@ -58,6 +58,10 @@
/**
* 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 @@
* 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 @@
}
}
+ /**
+ * @return bool
+ */
function isExpired() {
if ( !file_exists( $this->filename ) ) {
if ( $this->timestamp === false ) {
@@ -204,11 +211,16 @@
/**
* 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 @@
return $this->titleObj;
}
+ /**
+ * @return bool
+ */
function isExpired() {
$touched = $this->getTitle()->getTouched();
@@ -292,6 +307,9 @@
$this->timestamps = $this->calculateTimestamps();
}
+ /**
+ * @return array
+ */
function __sleep() {
return array( 'timestamps' );
}
@@ -304,6 +322,9 @@
return $this->linkBatch;
}
+ /**
+ * @return bool
+ */
function isExpired() {
$newTimestamps = $this->calculateTimestamps();
@@ -345,6 +366,9 @@
$this->value = $GLOBALS[$name];
}
+ /**
+ * @return bool
+ */
function isExpired() {
return $GLOBALS[$this->name] != $this->value;
}
@@ -361,6 +385,9 @@
$this->value = constant( $name );
}
+ /**
+ * @return bool
+ */
function isExpired() {
return constant( $this->name ) != $this->value;
}
Modified: trunk/phase3/includes/objectcache/BagOStuff.php
===================================================================
--- trunk/phase3/includes/objectcache/BagOStuff.php 2011-05-28 15:11:39 UTC
(rev 89039)
+++ trunk/phase3/includes/objectcache/BagOStuff.php 2011-05-28 15:59:57 UTC
(rev 89040)
@@ -43,6 +43,9 @@
abstract class BagOStuff {
private $debugMode = false;
+ /**
+ * @param $bool bool
+ */
public function setDebug( $bool ) {
$this->debugMode = $bool;
}
@@ -53,6 +56,8 @@
/**
* 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 );
Modified: trunk/phase3/includes/objectcache/MemcachedPhpBagOStuff.php
===================================================================
--- trunk/phase3/includes/objectcache/MemcachedPhpBagOStuff.php 2011-05-28
15:11:39 UTC (rev 89039)
+++ trunk/phase3/includes/objectcache/MemcachedPhpBagOStuff.php 2011-05-28
15:59:57 UTC (rev 89040)
@@ -21,7 +21,7 @@
* - 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 @@
$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 @@
/**
* Get the underlying client object. This is provided for debugging
* purposes.
+ *
+ * @return MemCachedClientforWiki
*/
public function getClient() {
return $this->client;
@@ -116,6 +166,10 @@
/**
* 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 );
Modified: trunk/phase3/includes/parser/Tidy.php
===================================================================
--- trunk/phase3/includes/parser/Tidy.php 2011-05-28 15:11:39 UTC (rev
89039)
+++ trunk/phase3/includes/parser/Tidy.php 2011-05-28 15:59:57 UTC (rev
89040)
@@ -17,13 +17,24 @@
*/
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 @@
}
/**
- * @private
+ * @param $m array
+ *
+ * @return string
*/
function replaceEditSectionLinksCallback( $m ) {
$marker = "{$this->mUniqPrefix}-item-{$this->mMarkerIndex}" .
Parser::MARKER_SUFFIX;
@@ -49,6 +62,10 @@
return $marker;
}
+ /**
+ * @param $text string
+ * @return string
+ */
public function postprocess( $text ) {
return $this->mTokens->replace( $text );
}
@@ -187,6 +204,12 @@
* 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;
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs