From 8a3117f0dc370e8b69b1ffe49cd02d1169829d4c Mon Sep 17 00:00:00 2001 From: Paul Gear Date: Sun, 28 Sep 2014 09:30:18 +1000 Subject: [PATCH] Rewrite ugly if-else one-liners as ternary operator --- html/includes/api_functions.inc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/html/includes/api_functions.inc.php b/html/includes/api_functions.inc.php index fe0a3c5cd..25d6079d3 100644 --- a/html/includes/api_functions.inc.php +++ b/html/includes/api_functions.inc.php @@ -343,8 +343,8 @@ function add_device() $message = "Missing the device hostname"; } $hostname = $data['hostname']; - if ($data['port']) { $port = mres($data['port']); } else { $port = $config['snmp']['port']; } - if ($data['transport']) { $transport = mres($data['transport']); } else { $transport = "udp"; } + $port = $data['port'] ? mres($data['port']) : $config['snmp']['port']; + $transport = $data['transport'] ? mres($data['transport'] : "udp"; if($data['version'] == "v1" || $data['version'] == "v2c") { if ($data['community'])