Add a new route to the collection

@param string $path
@param string $controller
@param string $action
@param string $method

@return $this
779661
public function addRoute(string $path, string $controller, string $action = 'index', string $method = Request::METHOD_GET) : self
    {
        $endPoint = new RouteEndpoint($this->namespace, $controller, $action, $method);
        $this->routes[] = new Route($path, $endPoint);
        
        return $this;
    }
416683
public static function set($method, $path, $action)
    {
        if (is_array($method)) {
            foreach ($method as $value) {
                self::set($value, $path, $action);
            }
        } else {
            if (is_string($action)) {
                $action = parent::$prefixNS . $action;
            } elseif ($action !== null && !$action instanceof \Closure) {
                return null;
            }

            $method = strtoupper(trim($method));

            $path = parent::$prefixPath . $path;

            if (!isset(parent::$httpRoutes[$path])) {
                parent::$httpRoutes[$path] = array();
            }

            parent::$httpRoutes[$path][$method] = $action;
        }
    }
876829
public function addMap($method, $module, $controller): Link
    {
        return $this->map[strtoupper($method)] = new Link($module, $controller);
    }
334464
public function set($method, $pattern, $action)
    {
        $method   = $this->getValidMethod($method);
        $patterns = $this->parser->parsePattern($pattern);
        $group    = new Group;

        foreach ($patterns as $pattern)
        {
            $route = new Route($this, $method, $pattern, $action);
            $group->setRoute($route);

            if (strpos($pattern, "{") !== false) {
                   $index = $this->getDynamicIndex($method, $pattern);
                   $this->dynamics[$index][$pattern] = $route;
            } else $this->statics[$method][$pattern] = $route;
        }

        return $group;
    }
892829
public function put(string $uri, string $controller, string $action)
    {
        $this->addRoute('PUT', $uri, $controller, $action);
    }
1134480
protected function createRoute( $methods, $uri, $action )
	{
		// If the route is routing to a controller we will parse the route action into
		// an acceptable array format before registering it and creating this route
		// instance itself. We need to build the Closure that will call this out.
		if ( $this->actionReferencesController( $action ) )
			$action = $this->convertToControllerAction( $action );

		$route = $this->newRoute( $methods, $this->prefix( $uri ), $action );

		// If we have groups that need to be merged, we will merge them now after this
		// route has already been created and is ready to go. After we're done with
		// the merge we will be ready to return the route back out to the caller.
		if ( $this->hasGroupStack() )
			$this->mergeGroupAttributesIntoRoute( $route );

		$this->addWhereClausesToRoute( $route );

		return $route;
	}
96844
private function addRoute($types = '', $uri, $action = [])
    {

        if (is_string($action)) {
            $action = ['_controller' => $action];
        }

        if (is_array($action)) {
            if (isset($action['as'])) {
                AsCollector::addAs($action['as'], $uri);
            }
        }

        $types = (array)$types;

        foreach ($types as $type) {
            $type = mb_convert_case($type, MB_CASE_UPPER);

            $add = [
                'uri' => isset(static::$firing['when']) ? $this->createWhenUri($uri) : $uri,
                'action' => $action
            ];;

            // add group parameter to action variable
            if (isset(static::$firing['group'])) {
                $add['group'] = static::$firing['group'];
            }

            // add to collection
            static::$routes[$type][] = $add;
        }
        return $this;
    }
1140329
public function addRoute(array $methods, array $versions, $uri, $action)
    {
        $this->createRouteCollections($versions);

        $route = new Route($methods, $uri, $action);
        $route->where($action['where']);

        foreach ($versions as $version) {
            $this->routes[$version]->add($route);
        }

        return $route;
    }
402045
public function addRoute(array $methods, string $path, string $handler)
  {
    $this->routeCollector->addRoute(
      $methods,
      $this->getPrefix().$path,
      $handler
    );

    return $this;
  }
631041
public function add($path, $controller, $name = null)
    {
        $route = new Route($path);
        $route->setDefault('_controller', $controller);
        $this->addRoute($route, $name);

        return $route;
    }
767624
public function add($url, $method, $action)
	{	
		$route = $this->factory->create($url, $method, $action);

		$this->routes[] = $route;

		foreach ($route->getMethod() as $method) {
			$this->routesByMethod[$method][] = $route;
		}
	}
1365701
function bind(method, path, controller, action) {
    let handler = controllerRegistry[controller] && controllerRegistry[controller][action]
    if (!handler) {
      console.warn(`can't bind route ${ path } to unknown action ${ controller }.${ action }`)
      return
    }

    const policyName = LocalUtil.getPolicyName(policy, controller, action)
    let currentPolicy
    if (policyName) currentPolicy = policyRegistry[policyName]

    if (currentPolicy) {
      router[method](path, currentPolicy, handler)
    } else {
      router[method](path, handler)
    }
  }
1144471
public function addRoute($methods, $uri, $action)
    {
        if (is_string($action)) {
            $action = ['uses' => $action];
        } elseif ($action instanceof Closure) {
            $action = [$action];
        }

        $action = $this->mergeLastGroupAttributes($action);

        $uri = $uri === '/' ? $uri : '/'.trim($uri, '/');

        if (! empty($action['prefix'])) {
            $uri = '/'.rtrim(trim($action['prefix'], '/').'/'.trim($uri, '/'), '/');

            unset($action['prefix']);
        }

        $action['uri'] = $uri;

        $action = $this->addRouteMiddlewares($action);

//        echo $action;
//        return $this->adapter->addRoute((array) $methods, $action['version'], $uri, $action);
        return $this->addRoute((array) $methods, $action['version'], $uri, $action);
    }
1136337
protected function createRoute($methods, $uri, $action)
    {
        if (is_callable($action)) {
            $action = array('uses' => $action);
        }

        // If the route is routing to a controller we will parse the route action into
        // an acceptable array format before registering it and creating this route
        // instance itself. We need to build the Closure that will call this out.
        else if ($this->actionReferencesController($action)) {
            $action = $this->convertToControllerAction($action);
        }

        // If no "uses" property has been set, we will dig through the array to find a
        // Closure instance within this list. We will set the first Closure we come
        // across into the "uses" property that will get fired off by this route.
        else if (! isset($action['uses'])) {
            $action['uses'] = $this->findActionClosure($action);
        }

        if (isset($action['middleware']) && is_string($action['middleware'])) {
            $action['middleware'] = explode('|', $action['middleware']);
        }

        $route = $this->newRoute(
            $methods, $uri = $this->prefix($uri), $action
        );

        // If we have groups that need to be merged, we will merge them now after this
        // route has already been created and is ready to go. After we're done with
        // the merge we will be ready to return the route back out to the caller.
        if (! empty($this->groupStack)) {
            $this->mergeGroupAttributesIntoRoute($route);
        }

        $this->addWhereClausesToRoute($route);

        return $route;
    }
1304577
public function routeTo(string $method, string $path, ...$args)
    {
        $event = strtoupper($method).' '.$path;

        $this
            ->getRouter()
            ->getEventHandler()
            ->trigger($event, ...$args);

        return $this;
    }
826801
public function initController($controller, $path)
    {
        if($path)
        {
            $controller = $this->name . '\\Controller\\' . $path . '\\' . $controller;
        }
        else
        {
            $controller = $this->name . '\\Controller\\' . $controller;
        }

        return new $controller();
    }
416996
public function addByController($controller, $action = 'index', $label = null)
    {
        $query['controller'] = $controller;
        $query['action']     = $action;

        if ($menuItem = $this->menu->findFirst($query)) {
            $this->addMenuItem($menuItem, $label);
        }

        return $this;
    }