From 77110537987f7d9a8499a54bc359e93e8662b4fd Mon Sep 17 00:00:00 2001 From: Alexis Date: Tue, 7 Feb 2023 13:57:48 +0100 Subject: [PATCH] SonarQube code smells resolve #12 --- Source/API/script/APIController.php | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/Source/API/script/APIController.php b/Source/API/script/APIController.php index e8e2577..f563b18 100644 --- a/Source/API/script/APIController.php +++ b/Source/API/script/APIController.php @@ -5,8 +5,6 @@ class APIController // private ScriptDatabase $script; public function __construct() { - // $this->script = new ScriptDatabase(); - // $this->script->executeScript(); try { if (empty($_REQUEST['action'])) { $action = NULL; @@ -14,21 +12,14 @@ class APIController $action = $_REQUEST['action']; } $listGateway = array("\\Gateway\\GatewayForm", "\\Gateway\\GatewayKeyword", "\\Gateway\\GatewayQuestion"); - foreach ($listGateway as $gateway) // Pour chaque Gateway - { - /* - * 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 + foreach ($listGateway as $gateway) { + if(method_exists($gateway, $action)) { + (new $gateway)->$action(); } } - } catch (PDOException) { return http_response_code(404); } exit(0); } - }