public function toString(Array $tree) {
    $text = '';
    while (!empty($tree)) {
      $node = array_shift($tree);

      $text .= str_repeat('  ',$node->getDepth()).(string) $node."\n";
    }
    
    return $text;
  }