Registers route

@param string          $name
@param string          $pattern
@param string|callable $controller
@param array           $arguments
@param array           $methods

@return $this
188139
public function route($name, $pattern, $controller, array $arguments = [], array $methods = [])
    {
        $this->router()->register($name, new Route($pattern, $controller, $arguments, $methods));

        return $this;
    }
1027347
public function addRoute($methods, string $pattern, string $handler)
    {
        if (is_string($methods)) {
            $methods = (array) $methods;
        }

        $methods = array_map('strtoupper', $methods);

        $this->routes[] = [
            $methods,
            $pattern,
            $handler
        ];
    }
599080
public function when($pattern, $name, $methods = null)
	{
		if ( ! is_null($methods)) $methods = array_map('strtoupper', (array) $methods);

		$this->patternFilters[$pattern][] = compact('name', 'methods');
	}
282140
public function query($method, $pattern, $callback)
    {
        $route = new Route($pattern, $callback, $method);
        $this['router']->addRoute($route);

        return $route;
    }
961436
public function controller( $uri, $controller, $names = [] )
	{
		$prepended = $controller;

		// First, we will check to see if a controller prefix has been registered in
		// the route group. If it has, we will need to prefix it before trying to
		// reflect into the class instance and pull out the method for routing.
		if ( !empty( $this->groupStack ) )
			$prepended = $this->prependGroupUses( $controller );

		$routable = ( new ControllerInspector )->getRoutable( $prepended, $uri );

		// When a controller is routed using this method, we use Reflection to parse
		// out all of the routable methods for the controller, then register each
		// route explicitly for the developers, so reverse routing is possible.
		foreach ( $routable as $method => $routes )
			foreach ( $routes as $route )
				$this->registerInspected( $route, $controller, $method, $names );

		$this->addFallthroughRoute( $controller, $uri );
	}
641135
public function route(
        string $method,
        string $definition,
        RequestHandlerInterface $handler,
        ?string $name = null,
        $data = null
    ): Route {
        $route = $this->factory->create($method, $definition, $handler, $name, $data);

        $this->routes[] = $route;

        if ($name !== null) {
            $this->named[$name] = $route;
        }

        return $route;
    }
804476
public function controller($uri, $controller, $names = array())
	{
		$prepended = $controller;

		// First, we will check to see if a controller prefix has been registered in
		// the route group. If it has, we will need to prefix it before trying to
		// reflect into the class instance and pull out the method for routing.
		if (count($this->groupStack) > 0)
		{
			$prepended = $this->prependGroupUses($controller);
		}

		$routable = $this->getInspector()->getRoutable($prepended, $uri);

		// When a controller is routed using this method, we use Reflection to parse
		// out all of the routable methods for the controller, then register each
		// route explicitly for the developers, so reverse routing is possible.
		foreach ($routable as $method => $routes)
		{
			foreach ($routes as $route)
			{
				$this->registerInspected($route, $controller, $method, $names);
			}
		}

		$this->addFallthroughRoute($controller, $uri);
	}
974637
public function map($methods, $pattern, $handler)
    {
        if (!is_string($pattern)) {
            throw new InvalidArgumentException('Route pattern must be a string');
        }

        // Prepend parent group pattern(s)
        if ($this->routeGroups) {
            $pattern = $this->processGroups().$pattern;
        }

        // Add route
        $route = new Route($methods, $pattern, $handler, $this->routeGroups);
        $this->routes[] = $route;

        return $route;
    }
755549
public function whenRegex($pattern, $name, $methods = null)
	{
		if ( ! is_null($methods)) $methods = array_map('strtoupper', (array) $methods);

		$this->regexFilters[$pattern][] = compact('name', 'methods');
	}
112167
public function connect($url, $name, $controller=null)
	{
		$this->_router->connect($url, $name, $controller);

		// register the controller if one is provided
		if(!is_null($controller))
		{
			$this->_controllers[$name] = $controller;
		}

		return $this;
	}
805234
public function route($method, $pattern, $callable, $conditions)
    {
        //reseta currentGroups para rotas futuras não herdarem seus middlewares
        $this->currentGroup = null;

        $method = strtoupper($method);
        $pattern = $this->validatePath($pattern);
        if (!is_null($this->routePrefix)) {
            $pattern = $this->routePrefix.$pattern;
        }

        $objRoute = new Route($pattern, $callable, $conditions);
        if (!is_null($this->routePrefix)) {
            $objRoute->setGroupPrefix($this->routePrefix);
        }

        $this->routes[$method][] = $objRoute;
        $this->lastRouteMethod = $method;
        return $this;
    }
1145907
public function define($pattern, $controller, $filters = array())
    {
        $rule = clone $this->rulePrototype;

        $rule->setPattern($pattern)->setController($controller)->setFilters($filters);

        array_push($this->rules, $rule);

        return $this;
    }
417685
public function setRoute($name, $pattern, array $replace = [], array $default = [])
    {
        $route = new \Mmi\Mvc\RouterConfigRoute;
        $route->name = $name;
        $route->pattern = $pattern;
        $route->replace = $replace;
        $route->default = $default;
        return $this->addRoute($route);
    }
1155224
public function get(string $name, ?string $pattern = null, array $options = []): RouteData
    {
        return $this->any($name, $pattern, $options)->methods('GET');
    }
599186
public function register($method, $pattern, $callable)
    {
        /**
         * 判断是否是
         */

        if ($pattern[0] != '|') {
            //非正则表达式的匹配段
            $pattern = $this->groupurl . $pattern;
        }
        $this->router->map($method, $pattern, $callable);
        return $this;
    }
431121
public static function register($name, $path, $controller, $methods=null, $restrictTo=null, $defaultResponse, $options=array()) {
		if( $methods && !is_array($methods) ) {
			$methods = array($methods);
		}
		foreach( static::$knownMethods as $method ) {
			if( (!$methods && !empty(static::$routes[$name][$method])) || ($methods && !in_array($method, $methods)) ) {
				continue;
			}
			static::$routes[$name][$method] = new static($name, $path, $controller, $method, $restrictTo, $defaultResponse, $options);
		}
	}
880595
public function addMap($pattern, $controller = null)
    {
        if (!is_string($controller)) {
            throw new \InvalidArgumentException(
                'Please give me controller name string. ' . ucfirst(gettype($controller)) . ' given.'
            );
        }

        if ($pattern instanceof Route) {
            throw new \LogicException('Do not use Route object in ' . get_called_class());
        }

        return parent::addRoute(null, $pattern, ['_controller' => $controller]);
    }