function ComposerRepository::canonicalizeUrl
Parameters
string $url:
Return value
non-empty-string
1 call to ComposerRepository::canonicalizeUrl()
- ComposerRepository::loadRootServerFile in vendor/
composer/ composer/ src/ Composer/ Repository/ ComposerRepository.php
File
-
vendor/
composer/ composer/ src/ Composer/ Repository/ ComposerRepository.php, line 1304
Class
- ComposerRepository
- @author Jordi Boggiano <j.boggiano@seld.be>
Namespace
Composer\RepositoryCode
private function canonicalizeUrl(string $url) : string {
if (strlen($url) === 0) {
throw new \InvalidArgumentException('Expected a string with a value and not an empty string');
}
if (str_starts_with($url, '/')) {
if (Preg::isMatch('{^[^:]++://[^/]*+}', $this->url, $matches)) {
return $matches[0] . $url;
}
return $this->url;
}
return $url;
}