From b838274280752504d62454ec9e459a6f6158e0e1 Mon Sep 17 00:00:00 2001 From: Ely Deckers Date: Mon, 21 Feb 2022 09:14:50 +0100 Subject: [PATCH] Remove redundant default_value parameter --- pfsense_zbx.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/pfsense_zbx.php b/pfsense_zbx.php index 87cfd9b..7299b0d 100644 --- a/pfsense_zbx.php +++ b/pfsense_zbx.php @@ -41,6 +41,8 @@ define("TEXT_RESERVED", gettext("reserved")); const SPEED_TEST_INTERVAL_HOURS = 8; const SPEED_TEST_INTERVAL_SECONDS = SPEED_TEST_INTERVAL_HOURS * 3600; +const FALLBACK_VALUE = 0; + const VALUE_MAPPINGS = [ "openvpn.server.status" => [ "down" => 0, @@ -1325,22 +1327,22 @@ class Command // Value mappings // Each value map is represented by an associative array - private static function get_value_mapping($value_name, $value, $default_value = "0") + private static function get_value_mapping($value_name, $value) { $is_known_value_name = array_key_exists($value_name, VALUE_MAPPINGS); if (!$is_known_value_name) { - return $default_value; + return FALLBACK_VALUE; } $value_mapping = VALUE_MAPPINGS[$value_name]; if (!is_array($value_mapping)) { - return $default_value; + return FALLBACK_VALUE; } $sanitized_value = strtolower($value); $is_value_with_known_mapping = array_key_exists($sanitized_value, $value_mapping); - return $is_value_with_known_mapping ? $value_mapping[$sanitized_value] : $default_value; + return $is_value_with_known_mapping ? $value_mapping[$sanitized_value] : FALLBACK_VALUE; } }