public static function parseSegments($path)
    {
        if (empty($path)) {
            throw new ValidationException("Cannot parse empty path");
        }
        $segments = [];
        $index = 0;
        $segments[] = self::parseSegmentFromPath($path, $index);
        while ($index < strlen($path)) {
            self::parseLiteralFromPath('/', $path, $index);
            $segments[] = self::parseSegmentFromPath($path, $index);
        }
        return $segments;
    }