protected function normalizePath($path)
{
// Remove any kind of funky unicode whitespace
$normalized = preg_replace('#\\p{C}+|^\\./#u', '', $path);
$normalized = $this->normalizeRelativePath($normalized);
if (preg_match('#/\\.{2}|^\\.{2}/|^\\.{2}$#', $normalized)) {
throw new LogicException('Path is outside of the defined root, path: [' . $path . '], resolved: [' . $normalized . ']');
}
$normalized = preg_replace('#\\\\{2,}#', '\\', trim($normalized, '\\'));
$normalized = preg_replace('#/{2,}#', '/', trim($normalized, '/'));
return $normalized;
}