Commit b12086a4 authored by Ad Schellevis's avatar Ad Schellevis

(systemhealth) style cleanup

parent e17757c8
...@@ -32,6 +32,7 @@ namespace OPNsense\Diagnostics\Api; ...@@ -32,6 +32,7 @@ namespace OPNsense\Diagnostics\Api;
use \OPNsense\Base\ApiControllerBase; use \OPNsense\Base\ApiControllerBase;
use \OPNsense\Core\Backend; use \OPNsense\Core\Backend;
/** /**
* Class ServiceController * Class ServiceController
* @package OPNsense\SystemHealth * @package OPNsense\SystemHealth
...@@ -41,8 +42,8 @@ class SystemhealthController extends ApiControllerBase ...@@ -41,8 +42,8 @@ class SystemhealthController extends ApiControllerBase
/** /**
* Return full archive information * Return full archive information
* @param array $xml * @param \SimpleXMLElement $xml rrd data xml
* @return array * @return array info set, metadata
*/ */
private function getDataSetInfo($xml) private function getDataSetInfo($xml)
{ {
...@@ -78,10 +79,10 @@ class SystemhealthController extends ApiControllerBase ...@@ -78,10 +79,10 @@ class SystemhealthController extends ApiControllerBase
/** /**
* Returns row number of first row with values other than 'NaN' * Returns row number of first row with values other than 'NaN'
* @param array $data * @param \SimpleXMLElement $data rrd data xml
* @return int * @return int rownumber
*/ */
private function findFirstValue($data = array()) private function findFirstValue($data)
{ {
$rowNumber = 0; $rowNumber = 0;
...@@ -104,10 +105,10 @@ class SystemhealthController extends ApiControllerBase ...@@ -104,10 +105,10 @@ class SystemhealthController extends ApiControllerBase
/** /**
* Return total number of rows in rra * Return total number of rows in rra
* @param array $data * @param \SimpleXMLElement $data rrd data xml
* @return int * @return int total number of rows
*/ */
private function countRows($data = array()) private function countRows($data)
{ {
$rowCount = 0; $rowCount = 0;
foreach ($data->database->row as $item => $row) { foreach ($data->database->row as $item => $row) {
...@@ -119,13 +120,13 @@ class SystemhealthController extends ApiControllerBase ...@@ -119,13 +120,13 @@ class SystemhealthController extends ApiControllerBase
/** /**
* internal: retrieve selections within range (0-0=full range) and limit number of datapoints (max_values) * internal: retrieve selections within range (0-0=full range) and limit number of datapoints (max_values)
* @param array $rra_info * @param array $rra_info dataset information
* @param int $from_timestamp * @param int $from_timestamp from
* @param int $to_timestamp * @param int $to_timestamp to
* @param $max_values * @param int $max_values approx. max number of values
* @return array * @return array
*/ */
private function getSelection($rra_info = array(), $from_timestamp = 0, $to_timestamp = 0, $max_values = 120) private function getSelection($rra_info, $from_timestamp, $to_timestamp, $max_values)
{ {
$full_range = false; $full_range = false;
if ($from_timestamp == 0 && $to_timestamp == 0) { if ($from_timestamp == 0 && $to_timestamp == 0) {
...@@ -183,7 +184,7 @@ class SystemhealthController extends ApiControllerBase ...@@ -183,7 +184,7 @@ class SystemhealthController extends ApiControllerBase
break; break;
} }
} }
if ( $overview != 0 ) { if ($overview != 0) {
$condensed_rowCount = (int)($rra_info[$last_rra_key]["available_rows"] / $overview); $condensed_rowCount = (int)($rra_info[$last_rra_key]["available_rows"] / $overview);
} else { } else {
$condensed_rowCount = 0; $condensed_rowCount = 0;
...@@ -208,7 +209,7 @@ class SystemhealthController extends ApiControllerBase ...@@ -208,7 +209,7 @@ class SystemhealthController extends ApiControllerBase
* @param array $rra_info * @param array $rra_info
* @return array * @return array
*/ */
private function getMaxRange($rra_info = array()) private function getMaxRange($rra_info)
{ {
// count the number if rra's (sets), deduct 1 as we need the counter to start at 0 // count the number if rra's (sets), deduct 1 as we need the counter to start at 0
$last_rra_key = count($rra_info) - 1; $last_rra_key = count($rra_info) - 1;
...@@ -235,7 +236,8 @@ class SystemhealthController extends ApiControllerBase ...@@ -235,7 +236,8 @@ class SystemhealthController extends ApiControllerBase
/** /**
* translate rrd data to usable format for d3 charts * translate rrd data to usable format for d3 charts
* @param array $data * @param array $data
* @param boolean $applyInverse * @param boolean $applyInverse inverse selection (multiply -1)
* @param array $field_units mapping for descriptive field names
* @return array * @return array
*/ */
private function translateD3($data, $applyInverse, $field_units) private function translateD3($data, $applyInverse, $field_units)
......
...@@ -28,11 +28,13 @@ ...@@ -28,11 +28,13 @@
*/ */
namespace OPNsense\Diagnostics; namespace OPNsense\Diagnostics;
use OPNsense\Base\IndexController;
/** /**
* Class IndexController * Class IndexController
* @package OPNsense\Proxy * @package OPNsense\Proxy
*/ */
class SystemhealthController extends \OPNsense\Base\IndexController class SystemhealthController extends IndexController
{ {
public function indexAction() public function indexAction()
{ {
...@@ -40,4 +42,3 @@ class SystemhealthController extends \OPNsense\Base\IndexController ...@@ -40,4 +42,3 @@ class SystemhealthController extends \OPNsense\Base\IndexController
$this->view->pick('OPNsense/Diagnostics/systemhealth'); $this->view->pick('OPNsense/Diagnostics/systemhealth');
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment