Skip to content

Commit

Permalink
Fix code style in the Perfdata view helper
Browse files Browse the repository at this point in the history
  • Loading branch information
lippserd committed Mar 30, 2015
1 parent 09d713b commit 5745c1f
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions modules/monitoring/application/views/helpers/Perfdata.php
Expand Up @@ -19,7 +19,6 @@ 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();

$results = array();
$table = array(
'<td><b>' . implode(
Expand Down Expand Up @@ -48,30 +47,28 @@ public function perfdata($perfdataStr, $compact = false, $limit = 0, $color = Pe
}
$row .= '</td>';

if (!$compact) {
if (! $compact) {
foreach ($perfdata->toArray() as $value) {
if ($value === '') {
$value = '-';
}
$row .= '<td>' . (string)$value . '</td>';
$row .= '<td>' . (string) $value . '</td>';
}
}

$row .= '</tr>';
$table[] = $row;
}
}

if ($limit > 0) {
$count = max (count($table), count ($results));
$table = array_slice ($table, 0, $limit);
$results = array_slice ($results, 0, $limit);
$count = max(count($table), count($results));
$table = array_slice($table, 0, $limit);
$results = array_slice($results, 0, $limit);
if ($count > $limit) {
$mess = sprintf($this->view->translate('%d more ...'), $count - $limit);
$results[] = '<span title="' . $mess . '">...</span>';
}
}

if ($compact) {
return join('', $results);
} else {
Expand Down

0 comments on commit 5745c1f

Please sign in to comment.