public function add($rule, $action = null)
    {
        $route = $this->di->get('route');
        $route->set($rule, $action);
        $this->routes[] = $route;

        // Set as default route
        if ($rule == "*") {
            $this->defaultRoute = $route;
        }
        
        return $route;
    }
public function add($rule, $action = null)
    {
        $route = $this->di->get('route');
        $route->set($rule, $action);
        $this->routes[] = $route;

        // Set as default route
        if ($rule == "*") {
            $this->defaultRoute = $route;
        }
        
        return $route;
    }
public function add ( $ rule , $ action = null ) { $ route = $ this -> di -> get ( 'route' ) ; $ route -> set ( $ rule , $ action ) ; $ this -> routes [ ] = $ route ; // Set as default route if ( $ rule == "*" ) { $ this -> defaultRoute = $ route ; } return $ route ; }
Add a route to the router.

@param string $rule   for this route
@param mixed  $action null, string or callable to implement a controller for the route

@return class as new route
Add a route to the router .