Commit d862b013 authored by ppetermann's avatar ppetermann

making Doctrine::dump() indent arrays

parent 94007b0a
...@@ -976,18 +976,22 @@ final class Doctrine ...@@ -976,18 +976,22 @@ final class Doctrine
* *
* @param mixed $var a variable of any type * @param mixed $var a variable of any type
* @param boolean $output whether to output the content * @param boolean $output whether to output the content
* @param string $indent indention string
* @return void|string * @return void|string
*/ */
public static function dump($var, $output = true) public static function dump($var, $output = true, $indent = "")
{ {
$ret = array(); $ret = array();
switch (gettype($var)) { switch (gettype($var)) {
case 'array': case 'array':
$ret[] = 'Array('; $ret[] = 'Array(';
$indent .= " ";
foreach ($var as $k => $v) { foreach ($var as $k => $v) {
$ret[] = $k . ' : ' . self::dump($v, false);
$ret[] = $indent . $k . ' : ' . self::dump($v, false, $indent);
} }
$ret[] = ")"; $indent = substr($indent,0, -4);
$ret[] = $indent . ")";
break; break;
case 'object': case 'object':
$ret[] = 'Object(' . get_class($var) . ')'; $ret[] = 'Object(' . get_class($var) . ')';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment