|
|
|
@ -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);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|