diff options
| Commit | fb2645d444729d656a209ef586a13fb569429280 (patch) | |
|---|---|---|
| Author | 2021-04-03 18:27:33 +0300 | |
| Committer | 2021-04-03 18:27:33 +0300 | |
| Files | 91daafcdb8af6cd41551bbf442f4be77dee575a4 /src/controllers/BaseController.php | |
| devrix-job-board-1.0.tar devrix-job-board-1.0.tar.gz devrix-job-board-1.0.zip | ||
| Parent | 67bc860ea4b3db5033a42038ab86d0df955c9295 (diff) | |
| Parent | 3b0cbc90e3046a8bb979c2b9a17fae5a94bb2707 (diff) | |
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!'; } } |
