public static function parse($uri) {
        if (strpos($uri, 'scope:') !== 0) {
            throw new \UnexpectedValueException(
                'Not a scope URI according to scheme');
        }

        $parts = explode('?', $uri, 1);
        $params = null;

        if (count($parts) > 1) {
            parse_str($parts[1], $params);
        }

        $parts = explode(':', $parts[0], 2);

        if (count($parts) != 3) {
            throw new \UnexpectedValueException(
                'Not enough parts for scope URI');
        }

        list($scheme, $service, $privilege) = $parts;
        return new ScopeURI($service, $privilege, $params);
    }