final public function getRoutes() { $Controller = $this->Controller; $routes = $Controller->routes; $path = $this->path; if(isset($path) && isset($routes[$path[0]])) { $route = $routes[$path[0]]; if(substr_count($route, '(') != substr_count($route, ')')) { throw new Exception(); } $route = preg_split("~/~", $route, -1, PREG_SPLIT_NO_EMPTY); $route = array_combine($route, $path); $action = $route[0]; array_shift($route); foreach($route as $key => $value) { preg_match("~\((?P.*)\)(?P.*)~", $key, $match); $this->variables[$match['key']] = typecast($value, $match['type']); } } else { $this->action = ($Controller->default_action) ? $Controller->default_action : 'index'; } }