Use built-in php sort functions

refs #8205
This commit is contained in:
Matthias Jentsch 2015-06-16 18:36:12 +02:00
parent d7e850da0e
commit 36622101ae
1 changed files with 5 additions and 12 deletions

View File

@ -19,19 +19,12 @@ class Zend_View_Helper_Perfdata extends Zend_View_Helper_Abstract
public function perfdata($perfdataStr, $compact = false, $limit = 0, $color = Perfdata::PERFDATA_OK)
{
$pieChartData = PerfdataSet::fromString($perfdataStr)->asArray();
if (1 < ($i = count($pieChartData))) {
while (--$i) {
for ($j = 0, $k = 1; $j < $i; ++$j, ++$k) {
if ($pieChartData[$k]->worseThan($pieChartData[$j])) {
$perfdata = $pieChartData[$k];
$pieChartData[$k] = $pieChartData[$j];
$pieChartData[$j] = $perfdata;
}
}
uasort(
$pieChartData,
function($a, $b) {
return $a->worseThan($b) ? -1 : ($b->worseThan($a) ? 1 : 0);
}
}
);
$results = array();
$table = array(
'<td><b>' . implode(