public static function resolvePath($urlPath, $basePath)
{
$urlParts = self::splitPath($urlPath);
$baseParts = self::splitPath($basePath);
$resolved = array_slice($baseParts, 0, -1);
foreach ($urlParts as $part) {
if ($part === '..') {
array_pop($resolved);
} else {
$resolved[] = $part;
}
}
return '/' . implode('/', $resolved);
}