diff options
Merge pull request #3 from Syndamia/dev v1.0
Exam version finished
1 files changed, 12 insertions, 9 deletions
| -rw-r--r-- | src/controllers/BaseController.php | 21 |
diff --git a/src/controllers/BaseController.php b/src/controllers/BaseController.php index 2c2a647..412cf25 100644 --- a/src/controllers/BaseController.php +++ b/src/controllers/BaseController.php @@ -1,14 +1,18 @@ <?php class BaseController { + /** + * Calls the get, post, put or delete static methods, depending on the server request method ($_SERVER['REQUEST_METHOD']) + * **By default** all requests that are not POST, PUT or DELETE execute the GET request method + */ public static function invoke() { - switch ($_SERVER["REQUEST_METHOD"]) { - case "POST": + switch ($_SERVER['REQUEST_METHOD']) { + case 'POST': static::post(); break; - case "PUT": + case 'PUT': static::put(); break; - case "DELETE": + case 'DELETE': static::delete(); break; default: @@ -18,19 +22,18 @@ class BaseController { } protected static function get() { - echo "GET method not implemented!"; + echo 'GET method not implemented!'; } protected static function post() { - - echo "POST method not implemented!"; + echo 'POST method not implemented!'; } protected static function put() { - echo "PUT method not implemented!"; + echo 'PUT method not implemented!'; } protected static function delete() { - echo "DELETE method not implemented!"; + echo 'DELETE method not implemented!'; } } |
