public static function removeEmptySegments($uri)
    {
        $uri = self::filterUri($uri);

        return self::normalizePath($uri, (new HierarchicalPath($uri->getPath()))->withoutEmptySegments());
    }