Files
global-autoresponder/exec/lib/Http.php
T
2026-06-02 19:19:00 +02:00

31 lines
688 B
PHP

<?php
declare(strict_types=1);
final class Http
{
public static function method(): string
{
return strtoupper((string)($_SERVER['REQUEST_METHOD'] ?? 'GET'));
}
public static function isPost(): bool
{
return self::method() === 'POST';
}
/**
* @param array<string,mixed> $source
*/
public static function getString(array $source, string $key, string $default = ''): string
{
$value = $source[$key] ?? $default;
return is_scalar($value) ? trim((string)$value) : $default;
}
public static function redirect(string $url): void
{
header('Location: ' . $url, true, 302);
exit;
}
}