/**
* Ensure the provided path hierarchy.
*
* @param array $tree The path elements that are required.
*
* @return DOMNode The parent directory for the file.
*/
public function getParent($tree)
{
$next = array_shift($tree);
while ($next === '') {
$next = array_shift($tree);
}
if (empty($tree) && !strlen($next)) {
return $this;
}
if (!isset($this->_subdirectories[$next])) {
$this->_subdirectories[$next] = $this->_create($this->_element->insertSubDirectory($next, $this->_getDirectoryInsertionPoint($next)), $this);
}
return $this->_subdirectories[$next]->getParent($tree);
}