Support method to add group of routes.

@param $method, HTTP Request method
@param $target, the route
@param $handler, Closure | Controller@method
@param $name, route name optional
545629
public static function add($method, $target, $handler, $name = null)
    {
        array_push(static::$prefixRoutes, [
            'method'  => $method, 'target' => $target,
            'handler' => $handler, 'name' => $name,
        ]);
    }
590609
protected function addRoute($method, $pattern, $callback, array $middleware = null, $name = null)
    {
        $concatenatedPattern = (!is_null($this->prefix) ? '/' . $this->prefix : '') .
            $pattern;

        $this->collector->addRoute(strtoupper($method), $concatenatedPattern, new Route($callback, $middleware));

        if ($name !== null) {
            $this->namedRoutes[$name] = $concatenatedPattern;
        }
    }
1341026
public function addHandler($name, $handler)
    {
        $tmp        = $this->relationHandlers->getValue($this->entity);
        $tmp[$name] = $handler;
        $this->relationHandlers->setValue($this->entity, $tmp);
    }
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
        ];
    }
239252
public function addPost(string $uri, string $handler, string $name = null)
    {
        $this->addRoute("POST", $uri, $handler, $name);
    }
17409
public function addRoute($methods, $uri, $action)
    {
        if (\is_string($action)) {
            $action = ['uses' => $action, 'controller' => $action];
        } elseif ($action instanceof Closure) {
            $action = [$action];
        }

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

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

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

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

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

        $action['uri'] = $uri;

        return $this->adapter->addRoute((array) $methods, $action['version'], $uri, $action);
    }
544366
protected function register($method, $route, $handler)
    {
        // Protect WordPress root route !
        if ($route == '/') {
            return;
        }

        // If the developer is registering multiple request methods to handle
        // the URI, we'll spin through each method and register the route
        // for each of them along with each URI and handler.

        // TODO : Only put the same method route to route array

        if (is_array($method)) {
            foreach ($method as $http) {
                $routeCollection = new Route($http, $route, new RouteHandler($handler));

                //Add this route to the $routeCollections params
                array_push($this->routeCollections, $routeCollection);
            }

            return;
        }

        // Create routeCollection from params
        $routeCollection = new Route($method, $route, new RouteHandler($handler));

        //Add this route to the $routeCollections params
        array_push($this->routeCollections, $routeCollection);

        return $this->routeCollections[sizeof($this->routeCollections) - 1];
    }
885193
public function put(
        string $definition,
        RequestHandlerInterface $handler,
        ?string $name = null,
        $data = null
    ): Route {
        return $this->route(Method::PUT, $definition, $handler, $name, $data);
    }
1269020
public function addMethod($name, $method) 
	{
		$this->methods[$name] = array(
			'name' => $name,
			'call' => $method
		);
		xmlrpc_server_register_method( $this->xmlrpc, $name, array( $this, 'call' ) );
	}
1306075
private function addRoute($name, array $route)
    {
        $this->rawRoutes[$name] = $route;

        $newRoute = new Route(
                $route['pattern'],
                $route['defaults'],
                array_key_exists('requirements', $route) ? $route['requirements'] : []
        );

        $this->add($name, $newRoute);

        $this->log('debug', sprintf('Route `%s` with pattern `%s` defined.', $name, $route['pattern']));
    }
242524
public function addRoute($method, $uri, $action)
    {
        $action = $this->parseAction($action);

        $attributes = null;

        if ($this->hasGroupStack()) {
            $attributes = $this->mergeWithLastGroup([]);
        }

        if (isset($attributes) && \is_array($attributes)) {
            if (isset($attributes['prefix'])) {
                $uri = \trim($attributes['prefix'], '/').'/'.\trim($uri, '/');
            }

            if (isset($attributes['suffix'])) {
                $uri = \trim($uri, '/').\rtrim($attributes['suffix'], '/');
            }

            $action = $this->mergeGroupAttributes($action, $attributes);
        }

        $uri = '/'.\trim($uri, '/');

        if (isset($action['as'])) {
            $this->namedRoutes[$action['as']] = $uri;
        }

        if (\is_array($method)) {
            foreach ($method as $verb) {
                $this->routes[$verb.$uri] = ['method' => $verb, 'uri' => $uri, 'action' => $action];
            }
        } else {
            $this->routes[$method.$uri] = ['method' => $method, 'uri' => $uri, 'action' => $action];
        }
    }
1070740
public function addRoute($methods, $pattern, $handler, array $requirements = [], array $defaults = [])
    {
        list ($name, $host, $schemes, $constraints) = $this->parseRequirements(
            $this->extendRequirements($requirements),
            $methods
        );

        $route = new Route(
            $this->prefixPattern($pattern),
            $handler,
            is_array($methods) ? $methods : explode('|', $methods),
            $host,
            $defaults,
            $constraints,
            is_array($schemes) ? $schemes : explode('|', $schemes)
        );

        $this->routes->add($name, $route);
    }
411491
def add(self, method, path_settings, target):
        
        self.routes.append(Route(method, path_settings, target))
        return
1318730
protected function handle(string $path, callable $action, $method, string $name = null): HttpRoute
    {
        if (!is_array($method)) {
            $method = [$method];
        }
        /** @var HttpRoute $route */
        $route = $this->data->createRoute($this->prefix . $path, $action, $name);
        $route->method(...$method);
        return $route;
    }
1083348
private function addMethod(string $method): void
    {
        if (!HttpMethod::isValid($method)) {
            throw new \InvalidArgumentException("Invalid HTTP request method '$method'");
        }

        $this->methods[] = $method;
    }
450619
public function addRoute($httpMethod, $route, $handler)
    {
        parent::addRoute($httpMethod, $route, $handler);

        // Route ended with slash , redirect non slash to slash
        if (substr($route, -1) === '/') {
            parent::addRoute($httpMethod, substr($route, 0, -1),
                new RouteHandler(
                    function () {

                        $url = tiga_url($this->request->getPathInfo().'/');

                        $response = \Tiga\Framework\Response\ResponseFactory::redirect($url);
                        $response->sendHeaders();
                        die();

                    })
                );
        }
        // Route ended with no slash , redirect slash to no slash
        else {
            $route .= '/';
            parent::addRoute($httpMethod, $route,
                new RouteHandler(
                    function () {
                        $url = rtrim(tiga_url($this->request->getPathInfo()), '/');

                        $response = \Tiga\Framework\Response\ResponseFactory::redirect($url);
                        $response->sendHeaders();
                        die();

                    })
                );
        }
    }
491970
public function addGet(string $uri, string $handler, string $name = null)
    {
        $this->addRoute("GET", $uri, $handler, $name);
    }