pour prod

This commit is contained in:
Loic Masi
2026-08-07 16:13:43 +02:00
commit 5fbf76868f
157 changed files with 24085 additions and 0 deletions

25
app/Core/Request.php Normal file
View File

@@ -0,0 +1,25 @@
<?php
declare(strict_types=1);
namespace App\Core;
final class Request
{
public static function json(): array
{
$payload = json_decode((string) file_get_contents('php://input'), true);
if (!is_array($payload)) {
JsonResponse::send(400, ['error' => 'Corps JSON invalide.']);
}
return $payload;
}
public static function requireMethod(string $method): void
{
if (strtoupper($_SERVER['REQUEST_METHOD'] ?? 'GET') !== strtoupper($method)) {
JsonResponse::send(405, ['error' => 'Méthode non autorisée.']);
}
}
}