diff options
Diffstat (limited to 'src/application/mystic/forum/utils/RequestUtils.php')
-rw-r--r-- | src/application/mystic/forum/utils/RequestUtils.php | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/application/mystic/forum/utils/RequestUtils.php b/src/application/mystic/forum/utils/RequestUtils.php new file mode 100644 index 0000000..2f40013 --- /dev/null +++ b/src/application/mystic/forum/utils/RequestUtils.php @@ -0,0 +1,19 @@ +<?php +declare(strict_types=1); + +namespace mystic\forum\utils; + +use mystic\forum\Messaging; + +final class RequestUtils { + use StaticClass; + + public static function ensureRequestMethod(string $method): void { + $rMethod = $_SERVER["REQUEST_METHOD"]; + if (strcasecmp($rMethod, $method) !== 0) { + http_response_code(500); + Messaging::error("Invalid request method $rMethod"); + exit; + } + } +} |