public function addRoute(Route $route): void
    {
        // Verify the dispatch
        $this->app->dispatcher()->verifyDispatch($route);

        // Set the path to the validated cleaned path (/some/path)
        $route->setPath($this->validatePath($route->getPath()));
        // Ensure the request methods are set
        $route->getRequestMethods();

        // If this is a dynamic route
        if ($route->isDynamic()) {
            // Set the dynamic route's properties through the path parser
            $this->setDynamicRoute($route);
        }

        // Set the route in the collection
        self::$collection->addRoute($route);
    }
public function addRoute(Route $route): void
    {
        // Verify the dispatch
        $this->app->dispatcher()->verifyDispatch($route);

        // Set the path to the validated cleaned path (/some/path)
        $route->setPath($this->validatePath($route->getPath()));
        // Ensure the request methods are set
        $route->getRequestMethods();

        // If this is a dynamic route
        if ($route->isDynamic()) {
            // Set the dynamic route's properties through the path parser
            $this->setDynamicRoute($route);
        }

        // Set the route in the collection
        self::$collection->addRoute($route);
    }
public function addRoute ( Route $ route ) : void { // Verify the dispatch $ this -> app -> dispatcher ( ) -> verifyDispatch ( $ route ) ; // Set the path to the validated cleaned path (/some/path) $ route -> setPath ( $ this -> validatePath ( $ route -> getPath ( ) ) ) ; // Ensure the request methods are set $ route -> getRequestMethods ( ) ; // If this is a dynamic route if ( $ route -> isDynamic ( ) ) { // Set the dynamic route's properties through the path parser $ this -> setDynamicRoute ( $ route ) ; } // Set the route in the collection self :: $ collection -> addRoute ( $ route ) ; }
Set a single route.

@param Route $route The route

@throws \InvalidArgumentException
@throws \Valkyrja\Dispatcher\Exceptions\InvalidClosureException
@throws \Valkyrja\Dispatcher\Exceptions\InvalidDispatchCapabilityException
@throws \Valkyrja\Dispatcher\Exceptions\InvalidFunctionException
@throws \Valkyrja\Dispatcher\Exceptions\InvalidMethodException
@throws \Valkyrja\Dispatcher\Exceptions\InvalidPropertyException

@return void
Set a single route .