From 27699b4cdf7b150acaf8b3d36bee7b3d844682a3 Mon Sep 17 00:00:00 2001 From: filippo.bertilotti <filippobertilotti@gmail.com> Date: Mon, 27 May 2024 11:06:44 +0200 Subject: [PATCH] inizializzazione classe Request per gestire le richieste (parte 145) --- src/Framework/Dispatcher.php | 2 +- public/index.php | 4 +++- src/Framework/Request.php | 12 ++++++++++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/public/index.php b/public/index.php index 4500409..8da6886 100644 --- a/public/index.php +++ b/public/index.php @@ -28,5 +28,7 @@ $dispatcher = new Framework\Dispatcher($router, $container); -$dispatcher->handle($path, $_SERVER["REQUEST_METHOD"]); +$request = new Framework\Request($_SERVER["REQUEST_URI"], $_SERVER["REQUEST_METHOD"]); + +$dispatcher->handle($request); \ No newline at end of file diff --git a/src/Framework/Dispatcher.php b/src/Framework/Dispatcher.php index c1a07dd..2c32755 100644 --- a/src/Framework/Dispatcher.php +++ b/src/Framework/Dispatcher.php @@ -9,7 +9,7 @@ public function __construct(private Router $router, private Container $container) { } - public function handle(string $path, $method) { + public function handle(Request $request) { $params = $this->router->match($path, $method); if($params === false) { diff --git a/src/Framework/Request.php b/src/Framework/Request.php new file mode 100644 index 0000000..4d53287 --- /dev/null +++ b/src/Framework/Request.php @@ -0,0 +1,12 @@ +<?php + +declare(strict_types= 1); + +namespace Framework; + +class Request { + public function __construct(public string $uri, public string $method) { + + } +} + -- Gitblit v1.8.0