inizializzazione classe Request per gestire le richieste (parte 145)
1 files added
2 files modified
| | |
| | | |
| | | $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); |
| | | |
| | |
| | | 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) { |
New file |
| | |
| | | <?php |
| | | |
| | | declare(strict_types= 1); |
| | | |
| | | namespace Framework; |
| | | |
| | | class Request { |
| | | public function __construct(public string $uri, public string $method) { |
| | | |
| | | } |
| | | } |
| | | |