summaryrefslogtreecommitdiff
path: root/src/application/mystic/forum/utils/RequestUtils.php
blob: 2f400137d05ba52c9706162cb0343bfd9e21eb04 (plain)
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;
        }
    }
}