private function pathToNode(RoutePath $path, Route $route, int $index): TreeNode
    {
        if ($path instanceof AttributePath) {
            return $this->createAttributeNode($path);
        }

        if ($path instanceof StaticPath) {
            return $this->createStaticNode($path);
        }

        if ($path instanceof OptionalPath) {
            return $this->createOptionalNode();
        }

        return $this->createLeafNode($route, $index);
    }
private function pathToNode(RoutePath $path, Route $route, int $index): TreeNode
    {
        if ($path instanceof AttributePath) {
            return $this->createAttributeNode($path);
        }

        if ($path instanceof StaticPath) {
            return $this->createStaticNode($path);
        }

        if ($path instanceof OptionalPath) {
            return $this->createOptionalNode();
        }

        return $this->createLeafNode($route, $index);
    }
private function pathToNode ( RoutePath $ path , Route $ route , int $ index ) : TreeNode { if ( $ path instanceof AttributePath ) { return $ this -> createAttributeNode ( $ path ) ; } if ( $ path instanceof StaticPath ) { return $ this -> createStaticNode ( $ path ) ; } if ( $ path instanceof OptionalPath ) { return $ this -> createOptionalNode ( ) ; } return $ this -> createLeafNode ( $ route , $ index ) ; }
Converts the given route path to a tree node.

@param RoutePath $path
@param Route $route
@param int $index
@return TreeNode
Converts the given route path to a tree node .