public function addRoute(Route $route): void
    {
        foreach( $route->getMethods() as $method ){

            if( array_key_exists($method, $this->routes) ){
                throw new \Exception("{$method}#{$this->path} route has already been defined.");
            }

            $this->routes[$method] = $route;
        }
    }
public function addRoute(Route $route): void
    {
        foreach( $route->getMethods() as $method ){

            if( array_key_exists($method, $this->routes) ){
                throw new \Exception("{$method}#{$this->path} route has already been defined.");
            }

            $this->routes[$method] = $route;
        }
    }
public function addRoute ( Route $ route ) : void { foreach ( $ route -> getMethods ( ) as $ method ) { if ( array_key_exists ( $ method , $ this -> routes ) ) { throw new \ Exception ( "{$method}#{$this->path} route has already been defined." ) ; } $ this -> routes [ $ method ] = $ route ; } }
Add route to this leaf.

@param Route $route
@return void
Add route to this leaf .