From: Arthur Richards Date: Wed, 29 Feb 2012 21:56:05 +0000 (+0000) Subject: Added unsetVal() method as antithesis to setVal() X-Git-Tag: 1.31.0-rc.0~24455 X-Git-Url: http://git.cyclocoop.org/%24href?a=commitdiff_plain;h=1c242d9690d9e23488545e6f259ee008fef2e179;p=lhc%2Fweb%2Fwiklou.git Added unsetVal() method as antithesis to setVal() --- diff --git a/includes/WebRequest.php b/includes/WebRequest.php index 826ee0d041..facb82bb1f 100644 --- a/includes/WebRequest.php +++ b/includes/WebRequest.php @@ -379,6 +379,23 @@ class WebRequest { 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.