protected function normalizePath($path)
{
$path = str_replace('\\', '/', $path);
$prefix = $this->getAbsolutePrefix($path);
$path = substr($path, strlen($prefix));
$parts = array_filter(explode('/', $path), 'strlen');
$tokens = array();
foreach ($parts as $part) {
switch ($part) {
case '.':
continue;
break;
case '..':
if (count($tokens) !== 0) {
array_pop($tokens);
continue;
} elseif (!empty($prefix)) {
continue;
}
break;
default:
$tokens[] = $part;
}
}
return $prefix . implode('/', $tokens);
}