1
0
Fork 0

Create method parseVersion for parsing of package versions. Now includes "max" version of the package.

pull/217/head
Henrique Moody 2012-01-17 16:26:29 -02:00
parent c7e0fb7e58
commit 1e11aff456
1 changed files with 21 additions and 17 deletions

View File

@ -125,6 +125,23 @@ class PearRepository extends ArrayRepository
}
}
/**
* @param array $data
* @return string
*/
private function parseVersion(array $data)
{
if (isset($data['min'])) {
$version = '>=' . $data['min'];
} else {
$version = '>=0.0.0';
}
if (isset($data['max'])) {
$version .= ',<=' . $data['max'];
}
return $version;
}
/**
* @todo Improve dependences of pear packages.
* @param array $options
@ -135,29 +152,16 @@ class PearRepository extends ArrayRepository
$data = array();
foreach ($depsOptions as $name => $options) {
if ('php' == $name) {
$key = $name;
if (isset($options['min'])) {
$value = '>=' . $options['min'];
} else {
$value = '>=0.0.0';
}
$data[$key] = $value;
$data[$name] = $this->parseVersion($options);
} elseif ('package' == $name) {
foreach ($options as $key => $value) {
$key = $value['name'];
if (isset($value['min'])) {
$value = '>=' . $value['min'];
} else {
$value = '>=0.0.0';
}
$data[$key] = $value;
$data[$key] = $this->parseVersion($value);
}
} elseif ('extension' == $name) {
foreach ($options as $key => $value) {
$key = 'ext-' . $value['name'];
$value = '*';
$data[$key] = $value;
$data[$key] = '*';
}
}
}