https://www.mediawiki.org/wiki/Special:Code/MediaWiki/112732
Revision: 112732
Author: awjrichards
Date: 2012-02-29 21:56:05 +0000 (Wed, 29 Feb 2012)
Log Message:
-----------
Added unsetVal() method as antithesis to setVal()
Modified Paths:
--------------
trunk/phase3/includes/WebRequest.php
Modified: trunk/phase3/includes/WebRequest.php
===================================================================
--- trunk/phase3/includes/WebRequest.php 2012-02-29 21:53:02 UTC (rev
112731)
+++ trunk/phase3/includes/WebRequest.php 2012-02-29 21:56:05 UTC (rev
112732)
@@ -379,7 +379,24 @@
return $ret;
}
+
/**
+ * Unset an arbitrary value from our get/post data.
+ *
+ * @param $key String: key name to use
+ * @return Mixed: old value if one was present, null otherwise
+ */
+ public function unsetVal( $key ) {
+ if ( !isset( $this->data[$key] ) ) {
+ $ret = null;
+ } else {
+ $ret = $this->data[$key];
+ unset( $this->data[$key] );
+ }
+ return $ret;
+ }
+
+ /**
* Fetch an array from the input or return $default if it's not set.
* If source was scalar, will return an array with a single element.
* If no source and no default, returns NULL.
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs