Permalink
Browse files

Added support for __debugInfo to debugger

  • Loading branch information...
1 parent ca2a4fb commit be02dd3d9df060708df3bb23da107996509591de @lorenzo lorenzo committed Mar 8, 2014
Showing with 10 additions and 4 deletions.
  1. +10 −4 src/Utility/Debugger.php
View
@@ -537,7 +537,7 @@ protected static function _array(array $var, $depth, $indent) {
$replace = array_intersect_key($secrets, $var);
$var = $replace + $var;
- $out = "array(";
+ $out = "[";
$break = $end = null;
if (!empty($var)) {
$break = "\n" . str_repeat("\t", $indent);
@@ -560,7 +560,7 @@ protected static function _array(array $var, $depth, $indent) {
} else {
$vars[] = $break . '[maximum depth reached]';
}
- return $out . implode(',', $vars) . $end . ')';
+ return $out . implode(',', $vars) . $end . ']';
}
/**
@@ -578,10 +578,16 @@ protected static function _object($var, $depth, $indent) {
$className = get_class($var);
$out .= 'object(' . $className . ') {';
+ $break = "\n" . str_repeat("\t", $indent);
+ $end = "\n" . str_repeat("\t", $indent - 1);
+
+ if (method_exists($var, '__debugInfo')) {
+ return $out . "\n" .
+ substr(static::_array($var->__debugInfo(), $depth - 1, $indent), 1, -1) .
+ $end . '}';
+ }
if ($depth > 0) {
- $end = "\n" . str_repeat("\t", $indent - 1);
- $break = "\n" . str_repeat("\t", $indent);
$objectVars = get_object_vars($var);
foreach ($objectVars as $key => $value) {
$value = static::_export($value, $depth - 1, $indent);

0 comments on commit be02dd3

Please sign in to comment.