private function addToTreeByReflection(ClassReflectionInterface $reflection)
{
$type = $this->getTypeByReflection($reflection);
if ($reflection->getParentClassName() === null) {
$name = $reflection->getName();
$this->treeStorage[$type][$name] = [];
$this->processed[$name] = true;
return;
}
$parents = array_values(array_reverse($reflection->getParentClasses()));
$cursor =& $this->treeStorage[$type];
foreach ($parents as $level => $parent) {
$name = $parent->getName();
if (!isset($cursor[$name])) {
$cursor[$name] = [];
$this->processed[$name] = true;
}
$cursor[$name][$reflection->getName()] = [];
// Traverse down the tree.
$cursor =& $cursor[$name];
}
}