[VarDumper] collapse/inline cut structures
This commit is contained in:
parent
ce8d3716a2
commit
8443268655
@ -127,16 +127,20 @@ class Data
|
||||
break;
|
||||
|
||||
case Stub::TYPE_ARRAY:
|
||||
$dumper->enterHash($cursor, $item->class, $item->value, (bool) $children);
|
||||
$cut = $this->dumpChildren($dumper, $cursor, $refs, $children, $cut, $item->class);
|
||||
$dumper->leaveHash($cursor, $item->class, $item->value, (bool) $children, $cut);
|
||||
break;
|
||||
|
||||
$item = clone $item;
|
||||
$item->type = $item->class;
|
||||
$item->class = $item->value;
|
||||
// No break;
|
||||
case Stub::TYPE_OBJECT:
|
||||
case Stub::TYPE_RESOURCE:
|
||||
$dumper->enterHash($cursor, $item->type, $item->class, (bool) $children);
|
||||
$withChildren = $children && $cursor->depth !== $this->maxDepth && $this->maxItemsPerDepth;
|
||||
$dumper->enterHash($cursor, $item->type, $item->class, $withChildren);
|
||||
if ($withChildren) {
|
||||
$cut = $this->dumpChildren($dumper, $cursor, $refs, $children, $cut, $item->type);
|
||||
$dumper->leaveHash($cursor, $item->type, $item->class, (bool) $children, $cut);
|
||||
} elseif ($children && 0 <= $cut) {
|
||||
$cut += count($children);
|
||||
}
|
||||
$dumper->leaveHash($cursor, $item->type, $item->class, $withChildren, $cut);
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -166,8 +170,6 @@ class Data
|
||||
*/
|
||||
private function dumpChildren($dumper, $parentCursor, &$refs, $children, $hashCut, $hashType)
|
||||
{
|
||||
if ($children) {
|
||||
if ($parentCursor->depth !== $this->maxDepth && $this->maxItemsPerDepth) {
|
||||
$cursor = clone $parentCursor;
|
||||
++$cursor->depth;
|
||||
$cursor->hashType = $hashType;
|
||||
@ -184,10 +186,6 @@ class Data
|
||||
return $hashCut >= 0 ? $hashCut + $cursor->hashLength - $cursor->hashIndex : $hashCut;
|
||||
}
|
||||
}
|
||||
} elseif ($hashCut >= 0) {
|
||||
$hashCut += count($children);
|
||||
}
|
||||
}
|
||||
|
||||
return $hashCut;
|
||||
}
|
||||
|
@ -224,9 +224,7 @@ EOTXT
|
||||
array:1 [
|
||||
0 => array:1 [
|
||||
0 => array:1 [
|
||||
0 => array:1 [
|
||||
…1
|
||||
]
|
||||
0 => array:1 [ …1]
|
||||
]
|
||||
]
|
||||
]
|
||||
|
Reference in New Issue
Block a user