Orno\Route\RouteCollection::addRoute PHP Метод

addRoute() публичный Метод

Add a route to the collection
public addRoute ( string $method, string $route, string | Closure $handler, integer $strategy = self::REQUEST_RESPONSE_STRATEGY ) : RouteCollection
$method string
$route string
$handler string | Closure
$strategy integer
Результат RouteCollection
    public function addRoute($method, $route, $handler, $strategy = self::REQUEST_RESPONSE_STRATEGY)
    {
        // are we running a single strategy for the collection?
        $strategy = isset($this->strategy) ? $this->strategy : $strategy;
        // if the handler is an anonymous function, we need to store it for later use
        // by the dispatcher, otherwise we just throw the handler string at FastRoute
        if ($handler instanceof \Closure) {
            $callback = $handler;
            $handler = uniqid('orno::route::', true);
            $this->routes[$handler]['callback'] = $callback;
        }
        $this->routes[$handler]['strategy'] = $strategy;
        $route = $this->parseRouteString($route);
        parent::addRoute($method, $route, $handler);
        return $this;
    }