| | |
| | | |
| | | |
| | | } |
| | | public function match (string $path,): array|bool { |
| | | |
| | | public function match (string $path): array|bool { |
| | | $path = urldecode($path); |
| | | |
| | | $path = trim($path, "/"); |
| | | |
| | | foreach ($this->routes as $route) { |
| | | |
| | | $pattern = $this->getPatternFromRoutePath($route["path"]); |
| | | |
| | | echo $pattern, "\n"; |
| | | |
| | | if(preg_match($pattern, $path, $matches)) { |
| | | $matches = array_filter($matches, "is_string", ARRAY_FILTER_USE_KEY); |
| | |
| | | return $segment; |
| | | }, $segments); |
| | | |
| | | return "#^" . implode("/", $segments) . "$#"; |
| | | return "#^" . implode("/", $segments) . "$#iu"; |
| | | } |
| | | } |