Added GetValue method that takes care of missing parameters.

git-svn-id: http://yate.null.ro/svn/yate/trunk@542 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
paulc 2005-10-17 15:29:22 +00:00
parent 8ee7985072
commit a704232d1f
1 changed files with 13 additions and 0 deletions

View File

@ -159,6 +159,19 @@ class Yate
$this->params=array();
}
/**
* Retrive the value of a named parameter
* @param $key Name of the parameter to retrive
* @param $defvalue (optional) Default value to return if parameter is not set
* @return Value of the $key parameter or $defvalue
*/
function GetValue($key, $defvalue = null)
{
if (isset($this->params[$key]))
return $this->params[$key];
return $defvalue;
}
/**
* Fill the parameter array from a text representation
* @param $parts A numerically indexed array with the key=value parameters