public static function decomposeUri(UriInterface $uri)
    {
        $stackPattern = '(?<stack>.*([^-]|--)|-*)';
        $hashPattern = '(?<hash>[0-9a-f]{6,40})';
        $filenamePattern = '(?<filename>[A-Za-z\-\0-\9]+)';
        $formatPattern = '(?<format>.{3,4})';
        $pathPattern = '(?<hash>-.+-)';
        $path = $uri->getPath();
        // hash with seo-filename
        if (preg_match('#^/'.$stackPattern.'/'.$hashPattern.'/'.$filenamePattern.'\.'.$formatPattern.'$#', $path, $matches) ||
            // hash without seo-filename
            preg_match('#^/'.$stackPattern.'/'.$hashPattern.'.'.$formatPattern.'$#', $path, $matches) ||
            // remote_path with seo-filename
            preg_match('#^/'.$stackPattern.'/'.$pathPattern.'/'.$filenamePattern.'\.'.$formatPattern.'$#', $path, $matches) ||
            // remote_path without seo-filename
            preg_match('#^/'.$stackPattern.'/'.$pathPattern.'.'.$formatPattern.'$#', $path, $matches)) {
            return UriComponents::createFromArray($matches);
        }
    }