SonarQube code smells resolve #12
continuous-integration/drone/push Build is passing Details

LoginModification
Alexis 2 years ago
parent 78c19fde0d
commit 7711053798

@ -5,8 +5,6 @@ class APIController
// private ScriptDatabase $script; // private ScriptDatabase $script;
public function __construct() public function __construct()
{ {
// $this->script = new ScriptDatabase();
// $this->script->executeScript();
try { try {
if (empty($_REQUEST['action'])) { if (empty($_REQUEST['action'])) {
$action = NULL; $action = NULL;
@ -14,21 +12,14 @@ class APIController
$action = $_REQUEST['action']; $action = $_REQUEST['action'];
} }
$listGateway = array("\\Gateway\\GatewayForm", "\\Gateway\\GatewayKeyword", "\\Gateway\\GatewayQuestion"); $listGateway = array("\\Gateway\\GatewayForm", "\\Gateway\\GatewayKeyword", "\\Gateway\\GatewayQuestion");
foreach ($listGateway as $gateway) // Pour chaque Gateway foreach ($listGateway as $gateway) {
{ if(method_exists($gateway, $action)) {
/* (new $gateway)->$action();
* On regarde si elle implémente une fonction du même nom que l'action reçue
*/
if(method_exists($gateway, $action))
{
(new $gateway)->$action(); // Si oui, on appelle cette fonction
} }
} }
} catch (PDOException) { } catch (PDOException) {
return http_response_code(404); return http_response_code(404);
} }
exit(0); exit(0);
} }
} }

Loading…
Cancel
Save