private function routeLoader($method, $path, $cb)
    {
        // We build the original path based on the application loader
        $path = $this->config['app.root'].$this->prefix.$path;

        // We define the current route and current method
        $this->current = ['path' => $path, 'method' => $method];

        // We add the new route
        $route = new Route($path, $cb);

        $route->middleware($this->middlewares);

        $this->routes[$method][] = $route;

        $route->middleware('trim');

        if (in_array($method, ['POST', 'DELETE', 'PUT'])) {
            $route->middleware('csrf');
        }

        return $route;
    }
private function routeLoader($method, $path, $cb)
    {
        // We build the original path based on the application loader
        $path = $this->config['app.root'].$this->prefix.$path;

        // We define the current route and current method
        $this->current = ['path' => $path, 'method' => $method];

        // We add the new route
        $route = new Route($path, $cb);

        $route->middleware($this->middlewares);

        $this->routes[$method][] = $route;

        $route->middleware('trim');

        if (in_array($method, ['POST', 'DELETE', 'PUT'])) {
            $route->middleware('csrf');
        }

        return $route;
    }
private function routeLoader ( $ method , $ path , $ cb ) { // We build the original path based on the application loader $ path = $ this -> config [ 'app.root' ] . $ this -> prefix . $ path ; // We define the current route and current method $ this -> current = [ 'path' => $ path , 'method' => $ method ] ; // We add the new route $ route = new Route ( $ path , $ cb ) ; $ route -> middleware ( $ this -> middlewares ) ; $ this -> routes [ $ method ] [ ] = $ route ; $ route -> middleware ( 'trim' ) ; if ( in_array ( $ method , [ 'POST' , 'DELETE' , 'PUT' ] ) ) { $ route -> middleware ( 'csrf' ) ; } return $ route ; }
Start loading a route.

@param string $method
@param string $path
@param Callable|string|array $cb
@return Route
Start loading a route .