Create method parseVersion for parsing of package versions. Now includes "max" version of the package.
parent
c7e0fb7e58
commit
1e11aff456
|
@ -124,6 +124,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.
|
* @todo Improve dependences of pear packages.
|
||||||
|
@ -135,29 +152,16 @@ class PearRepository extends ArrayRepository
|
||||||
$data = array();
|
$data = array();
|
||||||
foreach ($depsOptions as $name => $options) {
|
foreach ($depsOptions as $name => $options) {
|
||||||
if ('php' == $name) {
|
if ('php' == $name) {
|
||||||
$key = $name;
|
$data[$name] = $this->parseVersion($options);
|
||||||
if (isset($options['min'])) {
|
|
||||||
$value = '>=' . $options['min'];
|
|
||||||
} else {
|
|
||||||
$value = '>=0.0.0';
|
|
||||||
}
|
|
||||||
$data[$key] = $value;
|
|
||||||
|
|
||||||
} elseif ('package' == $name) {
|
} elseif ('package' == $name) {
|
||||||
foreach ($options as $key => $value) {
|
foreach ($options as $key => $value) {
|
||||||
$key = $value['name'];
|
$key = $value['name'];
|
||||||
if (isset($value['min'])) {
|
$data[$key] = $this->parseVersion($value);
|
||||||
$value = '>=' . $value['min'];
|
|
||||||
} else {
|
|
||||||
$value = '>=0.0.0';
|
|
||||||
}
|
|
||||||
$data[$key] = $value;
|
|
||||||
}
|
}
|
||||||
} elseif ('extension' == $name) {
|
} elseif ('extension' == $name) {
|
||||||
foreach ($options as $key => $value) {
|
foreach ($options as $key => $value) {
|
||||||
$key = 'ext-' . $value['name'];
|
$key = 'ext-' . $value['name'];
|
||||||
$value = '*';
|
$data[$key] = '*';
|
||||||
$data[$key] = $value;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue