1
0
mirror of synced 2024-12-13 22:56:04 +03:00

added dump() method

This commit is contained in:
zYne 2007-02-17 10:35:45 +00:00
parent d121a4cf2c
commit 9f42b87575

View File

@ -453,6 +453,33 @@ final class Doctrine
return true;
}
/**
* dump
*
* dumps a given variable
*
* @param mixed $var a variable of any type
* @return void|string
*/
public static function dump($var)
{
$ret = array();
switch (gettype($var)) {
case 'array':
$ret[] = 'Array(';
foreach ($var as $k => $v) {
$ret[] = $k . ' : ' . Doctrine::dump($v);
}
$ret[] = ')';
break;
case 'object';
$ret[] = 'Object(' . get_class($var) . ')';
break;
default:
$ret[] = var_export($var, true);
}
return implode("\n", $ret);
}
/**
* returns table name from class name
*