aboutsummaryrefslogtreecommitdiff
path: root/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'controllers')
-rw-r--r--controllers/meta.php14
1 files changed, 10 insertions, 4 deletions
diff --git a/controllers/meta.php b/controllers/meta.php
index ea26c30..e567ac3 100644
--- a/controllers/meta.php
+++ b/controllers/meta.php
@@ -4,9 +4,15 @@ foreach (glob("../models/*.php") as $filename) {
include $filename;
}
+function call_handler(string $name) {
+ if (function_exists($name)) {
+ call_user_func($name);
+ }
+}
+
match ($_SERVER['REQUEST_METHOD']) {
- 'POST' => on_post(),
- 'GET' => on_get(),
- 'PUT' => on_put(),
- 'DELETE' => on_delete(),
+ 'POST' => call_handler('on_post'),
+ 'GET' => call_handler('on_get'),
+ 'PUT' => call_handler('on_put'),
+ 'DELETE' => call_handler('on_delete'),
};