[a-zA-Z0-9_-]+)', $route); $routeRegex = '#^' . $routeRegex . '$#'; self::$routes[$method][$routeRegex] = [ 'controller' => $controller, 'action' => $action, 'original' => $route, ]; } /** * Dispatch router and run application * * @return void */ public static function dispatch(): void { // Create request $request = new Request($_POST + $_FILES); // Dispatch router RouteDispatcher::dispatch($request, self::$routes); } }