From 1c242d9690d9e23488545e6f259ee008fef2e179 Mon Sep 17 00:00:00 2001 From: Arthur Richards Date: Wed, 29 Feb 2012 21:56:05 +0000 Subject: [PATCH] Added unsetVal() method as antithesis to setVal() --- includes/WebRequest.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) 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. -- 2.20.1