public function getChild($name)
{
$nameParts = explode("/", $name);
$name = Element\Service::getValidKey($nameParts[count($nameParts) - 1], "asset");
if (is_string($name)) {
$parentPath = $this->asset->getRealFullPath();
if ($parentPath == "/") {
$parentPath = "";
}
if (!($asset = Asset::getByPath($parentPath . "/" . $name))) {
throw new DAV\Exception\NotFound('File not found: ' . $name);
}
} elseif ($name instanceof Asset) {
$asset = $name;
}
if ($asset instanceof Asset) {
if ($asset->getType() == "folder") {
return new Asset\WebDAV\Folder($asset);
} else {
return new Asset\WebDAV\File($asset);
}
}
throw new DAV\Exception\NotFound('File not found: ' . $name);
}