Add a new route

@param  string $method
@param  string $pattern
@param  mixed  $callback
@param  array  $params

@return $this
968171
public function add($method, $pattern, $callback, array $params = [])
    {
        $pattern = '/' . trim($pattern, '/');

        $pattern = rtrim($this->prefix . $pattern, '/');
        $pattern = $pattern ?: '/' . $pattern;

        if (!is_array($method)) {
            $method = [$method];
        }

        $before = $this->getParam($params, 'before');
        $after  = $this->getParam($params, 'after');
        $name   = $this->getParam($params, 'name');

        $before = $before ? explode('|', $params['before']) : [];
        $after  = $after ? explode('|', $params['after']) : [];

        $this->storeRoute($method, [
            'pattern'  => $pattern,
            'name'     => $name,
            'callback' => $callback,
            'before'   => array_merge($this->before, $before),
            'after'    => array_merge($this->after, $after),
            'args'     => [],
        ]);

        return $this;
    }
1154666
public function addRoute($method, $route, $callback)
    {
        return $this->routes[] = new Route(strtoupper($method), $route, $callback);
    }
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;
    }
1263920
def route(method, pattern, handler=None):
    
    if handler is None:
        return partial(route, method, pattern)
    return routes.append(method, pattern, handler)
903581
public function put(string $pattern, callable $callback)
    {
        if ($this->requestMethod === "PUT") {
            $this->mapRoute($pattern, $callback);
        }
    }
821986
public function put($pattern, $action, $name = null)
	{
		return $this->addRoute(['PUT'], $pattern, $action, $name);
	}
1141498
public function route(
        string $method,
        string $pattern,
        callable $callback,
        int $priority = 0
    ): RouterInterface {
        //hard requirement
        if (!is_callable($callback)) {
            throw HttpException::forInvalidRouteCallback();
        }

        if (strtoupper($method) === 'ALL') {
            $method = '[a-zA-Z0-9]+';
        }

        //find and organize all the dynamic parameters
        preg_match_all('#(\:[a-zA-Z0-9\-_]+)|(\*\*)|(\*)#s', $pattern, $matches);

        $keys = array();
        if (isset($matches[0]) && is_array($matches[0])) {
            $keys = $matches[0];
        }

        //replace the :variable-_name01
        $regex = preg_replace('#(\:[a-zA-Z0-9\-_]+)#s', '*', $pattern);

        //replace the stars
        //* -> ([^/]+)
        $regex = str_replace('*', '([^/]+)', $regex);
        //** -> ([^/]+)([^/]+) -> (.*)
        $regex = str_replace('([^/]+)([^/]+)', '(.*)', $regex);

        //now form the event pattern
        $event = '#^' . $method . '\s' . $regex . '/*$#is';

        //we need the handler for later
        $handler = $this->getEventHandler();

        $handler->on(
            $event,
            function (
                RequestInterface $request,
                ...$args
            ) use (
                $handler,
                $callback,
                $pattern,
                $keys
            ) {
                $route = $handler->getMeta();
                $variables = array();
                $parameters = array();

                //sanitize the variables
                foreach ($route['variables'] as $i => $variable) {
                    //if it's a * variable
                    if (!isset($keys[$i]) || strpos($keys[$i], '*') === 0) {
                        //it's a variable
                        if (strpos($variable, '/') === false) {
                            $variables[] = $variable;
                            continue;
                        }

                        $variables = array_merge($variables, explode('/', $variable));
                        continue;
                    }

                    //if it's a :parameter
                    if (isset($keys[$i])) {
                        $key = substr($keys[$i], 1);
                        $parameters[$key] = $variable;
                    }
                }

                $request
                    ->setStage($parameters)
                    ->setRoute(array(
                        'event' => $route['event'],
                        'variables' => $variables,
                        'parameters' => $parameters
                    ));

                return call_user_func($callback, $request, ...$args);
            },
            $priority
        );

        return $this;
    }
879033
public function delete(string $pattern, callable $callback)
    {
        if ($this->requestMethod === "DELETE") {
            $this->mapRoute($pattern, $callback);
        }
    }
381220
public function post(string $pattern, $func)
    {
        $method = strtoupper(__FUNCTION__);
        if (is_array($func)) {
            if ($this->isPatternMatches($pattern)) {
                $this->middleware = $func['middleware'];
            }
            $func = end($func);
        }
        if (!$func instanceof \Closure) {
            return $this->override($pattern, $func, false, $method);
        }

        return $this->match($method, $pattern, $func);
    }
350363
public function setRoute(array $methods, string $regexp, $callable): RouteInterface
    {
        return $this
            ->setMethods($methods)
            ->setRegexp($regexp)
            ->setCallback($callable);
    }
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
        ];
    }
201371
public function all($pattern, $handler)
    {

        return $this->addRoute(
            new Route([Method::GET, Method::POST], $pattern, $handler)
        );
    }
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;
    }
1029789
public function addRoute($pattern, $endpoint) {
        if(is_object($endpoint) && $endpoint instanceof \Fubber\Reactor\EndpointInterface) {
            // All is fine and dandy
        } elseif (is_callable($endpoint)) {
            // Make a CallbackController
            return $this->addRoute($pattern, new CallbackController($endpoint));
        } else {
            $this->notice('Host::addRoute(): Expects a callback or a controller');
            return FALSE;
        }

        $count = substr_count($pattern, '*');

        if ($count === 0) {
            // This is merely a direct route
            $this->extraRoutes[$pattern] = $this->routes[$pattern] = $endpoint;
        } else {
            // Add this route to the $this->searchRoutes and sort it again
            $this->extraRoutes[$pattern] = $endpoint;
            $this->searchRoutes[] = array($pattern, $endpoint);
        }
    }
848093
public function addMethod($method, $callback)
        {
            $this->traceInternal("Added '" . $method . "' to " . __METHOD__ . "()");
            $this->callbacks[$method] = $callback;
        }
1074304
public function put(string $pattern, $callback, array $requirements = [])
    {
        return $this->match($pattern, $callback, $requirements, [Request::METHOD_PUT]);
    }
122228
public function on($event,$pattern,$handler) {
		$bak = $this->f3->ROUTES;
		$this->f3->ROUTES=array();
		$this->f3->route($pattern,$handler);
		$this->routes[$event] = (isset($this->routes[$event]))
			? $this->f3->extend('ROUTES',$this->routes[$event]) : $this->f3->ROUTES;
		$this->f3->ROUTES=$bak;
	}