public static function normalizePath($path, $referencePath = null)
{
if ($path === '.') {
return $referencePath;
}
if (!is_string($path)) {
throw new \InvalidArgumentException(sprintf('An invalid node path was specified: is of type %s but a string is expected.', gettype($path)), 1357832901);
}
if (strpos($path, '//') !== false) {
throw new \InvalidArgumentException('Paths must not contain two consecutive slashes.', 1291371910);
}
if ($path[0] === '/') {
$absolutePath = $path;
} else {
$absolutePath = NodePaths::addNodePathSegment($referencePath, $path);
}
$normalizedPath = NodePaths::replaceRelativePathElements($absolutePath);
return strtolower($normalizedPath);
}