Merges nodes whose prefix ends with a slash
Children of a node whose prefix ends with a slash are moved to the parent node
public function mergeSlashNodes() {
$children = array();
foreach ($this as $child) {
if ($child instanceof self) {
$child
->mergeSlashNodes();
if ('/' === substr($child->prefix, -1)) {
$children = array_merge($children, $child
->all());
}
else {
$children[] = $child;
}
}
else {
$children[] = $child;
}
}
$this
->setAll($children);
}