if (!
$scheme) { $baseUrl =
$relative ?
base_path() :
$this->requestStack->
getCurrentRequest()->
getSchemeAndHttpHost() .
base_path();
return $this->
generatePath($baseUrl,
$uri);
} elseif ($scheme == 'http' ||
$scheme == 'https' ||
$scheme == 'data'
) { // Check for HTTP and data URI-encoded URLs so that we don't have to
// implement getExternalUrl() for the HTTP and data schemes.
return $relative ?
$this->
transformRelative($uri) :
$uri;
} elseif ($wrapper =
$this->streamWrapperManager->
getViaUri($uri)) { // Attempt to return an external URL using the appropriate wrapper.
$externalUrl =
$wrapper->
getExternalUrl();
return $relative ?
$this->
transformRelative($externalUrl) :
$externalUrl;
} throw new InvalidStreamWrapperException();
} /**
* Generate a URL path.
*
* @param string $base_url
* The base URL.
* @param string $uri
* The URI.
*
* @return string
* The URL path.
*/