src/Router.php
public function map(
        ?string $method,
        string $route,
        $controller,
        $middleware = [],
        string $domain = null,
        string $name = null
    ): Router {
        $name = $name ?: $this->currentName;
        $uri = $this->currentPrefix.$route;
        $middleware = is_array($middleware) ? $middleware : [$middleware];

        if (is_string($controller) && is_callable($controller) == false) {
            $controller = $this->currentNamespace."\\".$controller;
        }

        $route = new Route(
            $name,
            $uri,
            $method,
            $controller,
            array_merge($this->currentMiddleware, $middleware),
            $domain ?: $this->currentDomain
        );

        $this->routes[] = $route;

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

        return $this;
    }
public function map(
        ?string $method,
        string $route,
        $controller,
        $middleware = [],
        string $domain = null,
        string $name = null
    ): Router {
        $name = $name ?: $this->currentName;
        $uri = $this->currentPrefix.$route;
        $middleware = is_array($middleware) ? $middleware : [$middleware];

        if (is_string($controller) && is_callable($controller) == false) {
            $controller = $this->currentNamespace."\\".$controller;
        }

        $route = new Route(
            $name,
            $uri,
            $method,
            $controller,
            array_merge($this->currentMiddleware, $middleware),
            $domain ?: $this->currentDomain
        );

        $this->routes[] = $route;

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

        return $this;
    }
Map a controller to a route and set basic attributes

@param string $method
@param string $route
@param Closure|callable|string $controller
@param Middleware|string|Middleware[]|string[] $middleware
@param string|null $domain
@param string|null $name
@return $this