private function bindingToMapping(ResourceBinding $binding)
 {
     return new AssetMapping(substr($binding->getQuery(), 0, -8), $binding->getParameterValue(DiscoveryUrlGenerator::SERVER_PARAMETER), $binding->getParameterValue(DiscoveryUrlGenerator::PATH_PARAMETER), $binding->getUuid());
 }
 private function generateUrlForBinding(ResourceBinding $binding, $repositoryPath)
 {
     $serverName = $binding->getParameterValue(self::SERVER_PARAMETER);
     if (!isset($this->urlFormats[$serverName])) {
         throw new CannotGenerateUrlException(sprintf('The server "%s" mapped for path "%s" does not exist.', $serverName, $repositoryPath));
     }
     $repoBasePath = Glob::getStaticPrefix($binding->getQuery());
     $serverBasePath = trim($binding->getParameterValue(self::PATH_PARAMETER), '/');
     // The server path is generated by replacing the base repository path
     // (= the path of the binding) by the stored server base path in the
     // repository path of the resource.
     //
     // Example:
     //
     // resource path: /acme/blog/public/css/style.css
     // binding path: /acme/blog/public{,/**/*}
     // repo base path: /acme/blog/public
     // server base path: /blog
     //
     // final server path: /blog/css/style.css
     $serverPath = substr_replace($repositoryPath, $serverBasePath, 0, strlen($repoBasePath));
     // The server path is inserted into the "%s" parameter of the URL format
     return sprintf($this->urlFormats[$serverName], ltrim($serverPath, '/'));
 }