Allow get() to handle a default form value.
authorMichael M Slusarz <slusarz@curecanti.org>
Tue, 25 May 2010 19:42:21 +0000 (13:42 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Tue, 25 May 2010 19:43:59 +0000 (13:43 -0600)
framework/Util/lib/Horde/Variables.php

index 694d3cf..97b739f 100644 (file)
@@ -126,12 +126,15 @@ class Horde_Variables
      * Returns the value of a given form variable.
      *
      * @param string $varname  The form variable name.
+     * @param string $default  The default form variable value.
      *
      * @return mixed  The form variable, or null if it doesn't exist.
      */
-    public function get($varname)
+    public function get($varname, $default = null)
     {
-        return $this->__get($varname);
+        return $this->_getExists($this->_vars, $varname, $value)
+            ? $value
+            : $default;
     }
 
     /**