public function normalizePath($path)
{
$path = preg_replace('#/{2,}#', '/', strtr($path, '\\', '/'));
$parts = array();
foreach (explode('/', $path) as $i => $part) {
if ($part === '..') {
if (!empty($parts)) {
array_pop($parts);
}
} elseif ($part !== '.') {
$parts[] = $part;
}
}
return $parts;
}