defaults for argument functions

darcs-hash:20080709214433-84dde-4cb9de9ca054c54ebeb028bc3382ae07f4b7f5e1.gz
This commit is contained in:
Evan Prodromou 2008-07-09 17:44:33 -04:00
parent 5adb386774
commit 3b49268518

View File

@ -26,16 +26,16 @@ class Action { // lawsuit
function Action() {
}
function arg($key) {
function arg($key, $def=NULL) {
if (array_key_exists($key, $this->args)) {
return $this->args[$key];
} else {
return NULL;
return $def;
}
}
function trimmed($key) {
$arg = $this->arg($key);
function trimmed($key, $def=NULL) {
$arg = $this->arg($key, $def);
return (is_string($arg)) ? trim($arg) : $arg;
}