issue improve Object adds method

git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@10141 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
ovclas 2012-02-21 01:58:52 +00:00
parent bfcb28ea34
commit 2bd25445f8

View file

@ -79,12 +79,16 @@ class Object {
* @brief method to set multiple key/value pairs as an additional variables
* @param[in] $object either object or array containg key/value pairs to be added
**/
function adds($object) {
if(is_object($object)) {
$vars = get_object_vars($object);
foreach($vars as $key => $val) $this->add($key, $val);
} elseif(is_array($object)) {
foreach($object as $key => $val) $this->add($key, $val);
function adds($object)
{
if(is_object($object))
{
$object = get_object_vars($object);
}
if(is_array($object))
{
foreach($object as $key => $val) $this->variables[$key] = $val;
}
}