refactor: Use elseif instead of else if (#8417)

This commit is contained in:
Tony Murray
2018-03-19 16:40:17 -05:00
committed by Neil Lathwood
parent 10237ea097
commit 8cc8eb8dd2
13 changed files with 27 additions and 27 deletions

View File

@@ -48,7 +48,7 @@ class MoxaEtherdevice extends OS implements ProcessorDiscovery
if ($device['sysDescr'] == 'IKS-6726A-2GTXSFP-T') { if ($device['sysDescr'] == 'IKS-6726A-2GTXSFP-T') {
$oid = '.1.3.6.1.4.1.8691.7.116.1.54.0'; // MOXA-IKS6726A-MIB::cpuLoading30s.0 $oid = '.1.3.6.1.4.1.8691.7.116.1.54.0'; // MOXA-IKS6726A-MIB::cpuLoading30s.0
} else if ($device['sysDescr'] == 'EDS-G508E-T') { } elseif ($device['sysDescr'] == 'EDS-G508E-T') {
$oid = '.1.3.6.1.4.1.8691.7.69.1.54.0'; // MOXA-EDSG508E-MIB::cpuLoading30s.0 $oid = '.1.3.6.1.4.1.8691.7.69.1.54.0'; // MOXA-EDSG508E-MIB::cpuLoading30s.0
} }

View File

@@ -23,7 +23,7 @@ $urlargs = array(
); );
if (is_numeric($_GET['bill_hist_id'])) { if (is_numeric($_GET['bill_hist_id'])) {
$urlargs['bill_hist_id'] = $_GET['bill_hist_id']; $urlargs['bill_hist_id'] = $_GET['bill_hist_id'];
} else if (is_numeric($_GET['from']) && is_numeric($_GET['to'])) { } elseif (is_numeric($_GET['from']) && is_numeric($_GET['to'])) {
$urlargs['from'] = $_GET['from']; $urlargs['from'] = $_GET['from'];
$urlargs['to'] = $_GET['to']; $urlargs['to'] = $_GET['to'];
} }

View File

@@ -1364,7 +1364,7 @@ function get_bill_graphdata()
$reducefactor = $_GET['reducefactor']; $reducefactor = $_GET['reducefactor'];
$graph_data = getBillingBitsGraphData($bill_id, $from, $to, $reducefactor); $graph_data = getBillingBitsGraphData($bill_id, $from, $to, $reducefactor);
} else if ($graph_type == 'monthly') { } elseif ($graph_type == 'monthly') {
$graph_data = getHistoricTransferGraphData($bill_id); $graph_data = getHistoricTransferGraphData($bill_id);
} }

View File

@@ -25,7 +25,7 @@ if (is_admin() === false) {
$status = array('status' => 1, 'message' => 'Device dependency cannot be deleted.'); $status = array('status' => 1, 'message' => 'Device dependency cannot be deleted.');
} }
} }
} else if ($_POST['parent_ids']) { } elseif ($_POST['parent_ids']) {
$error = false; $error = false;
foreach ($_POST['parent_ids'] as $parent) { foreach ($_POST['parent_ids'] as $parent) {
if (is_numeric($parent) && $parent != 0) { if (is_numeric($parent) && $parent != 0) {
@@ -33,7 +33,7 @@ if (is_admin() === false) {
$error = true; $error = true;
$status = array('status' => 1, 'message' => 'Device dependency cannot be deleted.'); $status = array('status' => 1, 'message' => 'Device dependency cannot be deleted.');
} }
} else if ($parent == 0) { } elseif ($parent == 0) {
$status = array('status' => 1, 'message' => 'No dependency to delete.'); $status = array('status' => 1, 'message' => 'No dependency to delete.');
$error = true; $error = true;
break; break;

View File

@@ -40,7 +40,7 @@ if (is_admin() === false) {
foreach ($_POST['parent_ids'] as $parent) { foreach ($_POST['parent_ids'] as $parent) {
if (is_numeric($parent) && $parent != 0) { if (is_numeric($parent) && $parent != 0) {
$insert[] = array('parent_device_id' => $parent, 'child_device_id' => $dev); $insert[] = array('parent_device_id' => $parent, 'child_device_id' => $dev);
} else if ($parent == 0) { } elseif ($parent == 0) {
// In case we receive a mixed array with $parent = 0 (which shouldn't happen) // In case we receive a mixed array with $parent = 0 (which shouldn't happen)
// Empty the insert array so we remove any previous dependency so 'None' takes precedence // Empty the insert array so we remove any previous dependency so 'None' takes precedence
$insert = array(); $insert = array();

View File

@@ -111,7 +111,7 @@ $lineplot_out->SetWeight(1);
if (strtolower($graph_data['bill_type']) == 'cdr') { if (strtolower($graph_data['bill_type']) == 'cdr') {
$lineplot_95th = new LinePlot(array($graph_data['rate_95th'], $graph_data['rate_95th']), array($xmin, $xmax)); $lineplot_95th = new LinePlot(array($graph_data['rate_95th'], $graph_data['rate_95th']), array($xmin, $xmax));
$lineplot_95th->SetColor('red'); $lineplot_95th->SetColor('red');
} else if (strtolower($graph_data['bill_type']) == 'quota') { } elseif (strtolower($graph_data['bill_type']) == 'quota') {
$lineplot_ave = new LinePlot(array($graph_data['rate_average'], $graph_data['rate_average']), array($xmin, $xmax)); $lineplot_ave = new LinePlot(array($graph_data['rate_average'], $graph_data['rate_average']), array($xmin, $xmax));
$lineplot_ave->SetColor('red'); $lineplot_ave->SetColor('red');
} }
@@ -125,7 +125,7 @@ $graph->Add($lineplot_out);
if (strtolower($graph_data['bill_type']) == 'cdr') { if (strtolower($graph_data['bill_type']) == 'cdr') {
$graph->Add($lineplot_95th); $graph->Add($lineplot_95th);
} else if (strtolower($graph_data['bill_type']) == 'quota') { } elseif (strtolower($graph_data['bill_type']) == 'quota') {
$graph->Add($lineplot_ave); $graph->Add($lineplot_ave);
} }

View File

@@ -7,7 +7,7 @@ use Amenadiel\JpGraph\Plot\LinePlot;
if (is_numeric($vars['bill_hist_id'])) { if (is_numeric($vars['bill_hist_id'])) {
$graph_data = getBillingBandwidthGraphData($vars['id'], $vars['bill_hist_id'], null, null, $vars['imgtype']); $graph_data = getBillingBandwidthGraphData($vars['id'], $vars['bill_hist_id'], null, null, $vars['imgtype']);
} else if (is_numeric($vars['from'])) { } elseif (is_numeric($vars['from'])) {
$graph_data = getBillingBandwidthGraphData($vars['id'], null, $vars['from'], $vars['to'], $vars['imgtype']); $graph_data = getBillingBandwidthGraphData($vars['id'], null, $vars['from'], $vars['to'], $vars['imgtype']);
} else { } else {
$graph_data = getHistoricTransferGraphData($vars['id']); $graph_data = getHistoricTransferGraphData($vars['id']);

View File

@@ -17,7 +17,7 @@ if ($device['os'] == 'moxa-etherdevice') {
// Moxa people enjoy creating similar MIBs for each model! // Moxa people enjoy creating similar MIBs for each model!
if ($device['sysDescr'] == 'IKS-6726A-2GTXSFP-T') { if ($device['sysDescr'] == 'IKS-6726A-2GTXSFP-T') {
$mibmod = 'MOXA-IKS6726A-MIB'; $mibmod = 'MOXA-IKS6726A-MIB';
} else if ($device['sysDescr'] == 'EDS-G508E-T') { } elseif ($device['sysDescr'] == 'EDS-G508E-T') {
$mibmod = 'MOXA-EDSG508E-MIB'; $mibmod = 'MOXA-EDSG508E-MIB';
} }

View File

@@ -54,7 +54,7 @@ if (is_array($oids)) {
$current_value_string = $entry[$state_name]; $current_value_string = $entry[$state_name];
if ($current_value_string == 'OK') { if ($current_value_string == 'OK') {
$current_value = 1; $current_value = 1;
} else if ($current_value_string == 'OPEN') { } elseif ($current_value_string == 'OPEN') {
$current_value = 2; $current_value = 2;
} }

View File

@@ -23,7 +23,7 @@
// Moxa people enjoy creating similar MIBs for each model! // Moxa people enjoy creating similar MIBs for each model!
if ($device['sysDescr'] == 'IKS-6726A-2GTXSFP-T') { if ($device['sysDescr'] == 'IKS-6726A-2GTXSFP-T') {
$mibmod = 'MOXA-IKS6726A-MIB'; $mibmod = 'MOXA-IKS6726A-MIB';
} else if ($device['sysDescr'] == 'EDS-G508E-T') { } elseif ($device['sysDescr'] == 'EDS-G508E-T') {
$mibmod = 'MOXA-EDSG508E-MIB'; $mibmod = 'MOXA-EDSG508E-MIB';
} }

View File

@@ -30,7 +30,7 @@ $data = explode(".", $device["sysObjectID"]);
$id = end($data); $id = end($data);
if ($id == "1") { if ($id == "1") {
$hardware = "C4"; $hardware = "C4";
} else if ($id == "2") { } elseif ($id == "2") {
$hardware = "C4c"; $hardware = "C4c";
} }
unset($data); unset($data);

View File

@@ -14,7 +14,7 @@
// Moxa people enjoy creating MIBs for each model! // Moxa people enjoy creating MIBs for each model!
if ($device['sysDescr'] == 'IKS-6726A-2GTXSFP-T') { if ($device['sysDescr'] == 'IKS-6726A-2GTXSFP-T') {
$mibmod = 'MOXA-IKS6726A-MIB'; $mibmod = 'MOXA-IKS6726A-MIB';
} else if ($device['sysDescr'] == 'EDS-G508E-T') { } elseif ($device['sysDescr'] == 'EDS-G508E-T') {
$mibmod = 'MOXA-EDSG508E-MIB'; $mibmod = 'MOXA-EDSG508E-MIB';
} }
$version = snmp_get($device, "firmwareVersion.0", "-OQvs", $mibmod); $version = snmp_get($device, "firmwareVersion.0", "-OQvs", $mibmod);

View File

@@ -89,7 +89,7 @@ if (!empty($options['h'])) {
} }
if (empty($options['s']) && empty($options['h'])) { if (empty($options['s']) && empty($options['h'])) {
echo "Please set -s or -h\n"; echo "Please set -s or -h\n";
} else if (!empty($options['s']) && !empty($options['h'])) { } elseif (!empty($options['s']) && !empty($options['h'])) {
echo "Please set either -s or -h, not both\n"; echo "Please set either -s or -h, not both\n";
} }
if (!empty($options['i']) && !empty($options['h'])) { if (!empty($options['i']) && !empty($options['h'])) {