public function resolveDownloadFileName($version)
{
$url = $this->buildPackageDownloadUrl($version);
// Check if the url is for php source archive
if (preg_match('/php-.+\\.tar\\.(bz2|gz|xz)/', $url, $parts)) {
return $parts[0];
}
// try to get the filename through parse_url
$path = parse_url($url, PHP_URL_PATH);
if (false === $path || false === strpos($path, '.')) {
return;
}
return basename($path);
}