1
0
Fork 0

Correction at method parseVersion() of Composer\Repository\PearRepository.

pull/217/head
Henrique Moody 2012-01-17 17:02:39 -02:00
parent be448e09b4
commit 234a6710a1
1 changed files with 11 additions and 8 deletions

View File

@ -124,22 +124,24 @@ class PearRepository extends ArrayRepository
} }
} }
} }
/** /**
* @param array $data * @param array $data
* @return string * @return string
*/ */
private function parseVersion(array $data) private function parseVersion(array $data)
{ {
if (!isset($data['min']) && !isset($data['max'])) {
return '*';
}
$versions = array();
if (isset($data['min'])) { if (isset($data['min'])) {
$version = '>=' . $data['min']; $versions[] = '>=' . $data['min'];
} else {
$version = '>=0.0.0';
} }
if (isset($data['max'])) { if (isset($data['max'])) {
$version .= ',<=' . $data['max']; $versions[] = '<=' . $data['max'];
} }
return $version; return implode(',', $versions);
} }
/** /**
@ -155,7 +157,7 @@ class PearRepository extends ArrayRepository
$data[$name] = $this->parseVersion($options); $data[$name] = $this->parseVersion($options);
} elseif ('package' == $name) { } elseif ('package' == $name) {
foreach ($options as $key => $value) { foreach ($options as $key => $value) {
$dataKey = $value['name']; $dataKey = $value['name'];
$data[$dataKey] = $this->parseVersion($value); $data[$dataKey] = $this->parseVersion($value);
} }
} elseif ('extension' == $name) { } elseif ('extension' == $name) {
@ -165,6 +167,7 @@ class PearRepository extends ArrayRepository
} }
} }
} }
var_dump($data);die;
return $data; return $data;
} }