Fix Scrutinizer errors

This commit is contained in:
Paul Gear
2014-09-28 09:30:36 +10:00
parent 8a3117f0dc
commit 508e0b816d

View File

@@ -330,8 +330,9 @@ function add_device()
global $config; global $config;
$app = \Slim\Slim::getInstance(); $app = \Slim\Slim::getInstance();
$data = json_decode(file_get_contents('php://input'), true); $data = json_decode(file_get_contents('php://input'), true);
// Default status to error and change it if we need to. // Default status & code to error and change it if we need to.
$status = "error"; $status = "error";
$code = 500;
// keep scrutinizer from complaining about snmpver not being set for all execution paths // keep scrutinizer from complaining about snmpver not being set for all execution paths
$snmpver = "v2c"; $snmpver = "v2c";
if(empty($data)) if(empty($data))
@@ -385,8 +386,6 @@ function add_device()
} }
else else
{ {
$code = 500;
$status = "error";
$message = "Failed adding $hostname"; $message = "Failed adding $hostname";
} }
} }
@@ -405,7 +404,6 @@ function del_device()
$app = \Slim\Slim::getInstance(); $app = \Slim\Slim::getInstance();
$router = $app->router()->getCurrentRoute()->getParams(); $router = $app->router()->getCurrentRoute()->getParams();
$hostname = $router['hostname']; $hostname = $router['hostname'];
$output = array();
// Default status to error and change it if we need to. // Default status to error and change it if we need to.
$status = "error"; $status = "error";
$code = 500; $code = 500;