protected function addBranch(string $key): RouteBranch
    {
        if( array_key_exists($key, $this->branches) ){
            throw new \Exception("{$key} branch already exists for this node.");
        }

        $this->branches[$key] = new RouteBranch("{$this->path}/{$key}");
        return $this->branches[$key];
    }
protected function addBranch(string $key): RouteBranch
    {
        if( array_key_exists($key, $this->branches) ){
            throw new \Exception("{$key} branch already exists for this node.");
        }

        $this->branches[$key] = new RouteBranch("{$this->path}/{$key}");
        return $this->branches[$key];
    }
protected function addBranch ( string $ key ) : RouteBranch { if ( array_key_exists ( $ key , $ this -> branches ) ) { throw new \ Exception ( "{$key} branch already exists for this node." ) ; } $ this -> branches [ $ key ] = new RouteBranch ( "{$this->path}/{$key}" ) ; return $ this -> branches [ $ key ] ; }
Add a branch dangling from this branch.

@param string $key
@param RouteBranch $routeBranch
@return RouteBranch
Add a branch dangling from this branch .