1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 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; } } }