corso https://vola.udemy.com/course/php-mvc-from-scratch/learn/lecture/40931984#overview
filippo.bertilotti
2024-05-07 931be5e6dc02a5b01e71b3449edfff6ac44a3ae5
commit | author | age
c958d0 1 <?php
F 2
3 class Router {
4     private array $routes = [];
5     
6     public function add(string $path, array $params = []): void {
7         $this->routes[] = [
8             "path"=> $path,
9             "params"=> $params
10         ];
11
931be5 12
F 13     }
14     public function match (string $path,): array|bool {
15         foreach ($this->routes as $route) {
16             if ($route["path"] === $path) {
17                 return $route["params"];
18             }
19         }
20         return false;
c958d0 21     }
F 22 }