protected function getPackageXml($packageName, $version)
{
$channel = new PeclChannel($this->site);
$baseUrl = $channel->getRestBaseUrl();
$url = "{$baseUrl}/r/" . strtolower($packageName);
$downloader = new CurlDownloader();
$downloader = DownloadFactory::getInstance($this->logger, $this->options);
// translate version name into numbers
if (in_array($version, array('stable', 'latest', 'beta'))) {
$stabilityTxtUrl = $url . '/' . $version . '.txt';
if ($ret = $downloader->request($stabilityTxtUrl)) {
$version = (string) $ret;
} else {
throw new Exception("Can not translate stability {$version} into exact version name.");
}
}
$xmlUrl = $url . '/' . $version . '.xml';
if ($ret = $downloader->request($xmlUrl)) {
$dom = new DOMDocument('1.0');
$dom->strictErrorChecking = false;
$dom->preserveWhiteSpace = false;
// $dom->resolveExternals = false;
if (false === $dom->loadXml($ret)) {
throw new Exception("Error in XMl document: {$url}");
}
return $dom;
}
return false;
}