traverseForVisitor example

$this->visitors[$visitor->getPriority()][] = $visitor;
    }

    /** * Traverses a node and calls the registered visitors. */
    public function traverse(Node $node): Node
    {
        ksort($this->visitors);
        foreach ($this->visitors as $visitors) {
            foreach ($visitors as $visitor) {
                $node = $this->traverseForVisitor($visitor$node);
            }
        }

        return $node;
    }

    private function traverseForVisitor(NodeVisitorInterface $visitor, Node $node): ?Node
    {
        $node = $visitor->enterNode($node$this->env);

        foreach ($node as $k => $n) {
            
Home | Imprint | This part of the site doesn't use cookies.