Skip to content

Commit

Permalink
Add ext-ds support
Browse files Browse the repository at this point in the history
  • Loading branch information
enumag committed May 6, 2021
1 parent d44afd6 commit a34ebca
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Tracy/Dumper/Dumper.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ class Dumper
\DOMNode::class => [Exposer::class, 'exposeDOMNode'],
\DOMNodeList::class => [Exposer::class, 'exposeDOMNodeList'],
\DOMNamedNodeMap::class => [Exposer::class, 'exposeDOMNodeList'],
\Ds\Collection::class => [Exposer::class, 'exposeDsCollection'],
\Ds\Map::class => [Exposer::class, 'exposeDsMap'],
];

/** @var Describer */
Expand Down
23 changes: 23 additions & 0 deletions src/Tracy/Dumper/Exposer.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,4 +179,27 @@ public static function exposePhpIncompleteClass(
}
$value->value = $class . ' (Incomplete Class)';
}


public static function exposeDsCollection(
\Ds\Collection $obj,
Value $value,
Describer $describer
): void {
foreach ($obj as $objectKey => $objectValue) {
$describer->addPropertyTo($value, (string) $objectKey, $objectValue, Value::PROP_PRIVATE);
}
}


public static function exposeDsMap(
\Ds\Map $obj,
Value $value,
Describer $describer
): void {
$i = 0;
foreach ($obj as $objectKey => $objectValue) {
$describer->addPropertyTo($value, (string) $i++, new \Ds\Pair($objectKey, $objectValue), Value::PROP_PRIVATE);
}
}
}

0 comments on commit a34ebca

Please sign in to comment.