protected function transpileNodes(AbstractSyntaxTree $ast) : string
    {
        $transpiledView = '';
        $rootNode = $ast->getRootNode();
        $previousNodeWasExpression = false;

        foreach ($rootNode->getChildren() as $childNode) {
            switch (get_class($childNode)) {
                case DirectiveNode::class:
                    $transpiledView .= $this->transpileDirectiveNode($childNode);
                    $previousNodeWasExpression = false;

                    break;
                case SanitizedTagNode::class:
                    $transpiledView .= $this->transpileSanitizedTagNode($childNode);
                    $previousNodeWasExpression = false;

                    break;
                case UnsanitizedTagNode::class:
                    $transpiledView .= $this->transpileUnsanitizedTagNode($childNode);
                    $previousNodeWasExpression = false;

                    break;
                case CommentNode::class:
                    $transpiledView .= $this->transpileCommentNode($childNode);
                    $previousNodeWasExpression = false;

                    break;
                case ExpressionNode::class:
                    // To keep expressions from running against each other, we pad all expressions but the first
                    if ($previousNodeWasExpression) {
                        $transpiledView .= ' ';
                    }

                    $transpiledView .= $this->transpileExpressionNode($childNode);
                    $previousNodeWasExpression = true;

                    break;
                default:
                    throw new RuntimeException(
                        sprintf(
                            'Unknown node class %s',
                            get_class($childNode)
                        )
                    );
            }
        }

        return $transpiledView;
    }
protected function transpileNodes(AbstractSyntaxTree $ast) : string
    {
        $transpiledView = '';
        $rootNode = $ast->getRootNode();
        $previousNodeWasExpression = false;

        foreach ($rootNode->getChildren() as $childNode) {
            switch (get_class($childNode)) {
                case DirectiveNode::class:
                    $transpiledView .= $this->transpileDirectiveNode($childNode);
                    $previousNodeWasExpression = false;

                    break;
                case SanitizedTagNode::class:
                    $transpiledView .= $this->transpileSanitizedTagNode($childNode);
                    $previousNodeWasExpression = false;

                    break;
                case UnsanitizedTagNode::class:
                    $transpiledView .= $this->transpileUnsanitizedTagNode($childNode);
                    $previousNodeWasExpression = false;

                    break;
                case CommentNode::class:
                    $transpiledView .= $this->transpileCommentNode($childNode);
                    $previousNodeWasExpression = false;

                    break;
                case ExpressionNode::class:
                    // To keep expressions from running against each other, we pad all expressions but the first
                    if ($previousNodeWasExpression) {
                        $transpiledView .= ' ';
                    }

                    $transpiledView .= $this->transpileExpressionNode($childNode);
                    $previousNodeWasExpression = true;

                    break;
                default:
                    throw new RuntimeException(
                        sprintf(
                            'Unknown node class %s',
                            get_class($childNode)
                        )
                    );
            }
        }

        return $transpiledView;
    }
protected function transpileNodes ( AbstractSyntaxTree $ ast ) : string { $ transpiledView = '' ; $ rootNode = $ ast -> getRootNode ( ) ; $ previousNodeWasExpression = false ; foreach ( $ rootNode -> getChildren ( ) as $ childNode ) { switch ( get_class ( $ childNode ) ) { case DirectiveNode :: class : $ transpiledView .= $ this -> transpileDirectiveNode ( $ childNode ) ; $ previousNodeWasExpression = false ; break ; case SanitizedTagNode :: class : $ transpiledView .= $ this -> transpileSanitizedTagNode ( $ childNode ) ; $ previousNodeWasExpression = false ; break ; case UnsanitizedTagNode :: class : $ transpiledView .= $ this -> transpileUnsanitizedTagNode ( $ childNode ) ; $ previousNodeWasExpression = false ; break ; case CommentNode :: class : $ transpiledView .= $ this -> transpileCommentNode ( $ childNode ) ; $ previousNodeWasExpression = false ; break ; case ExpressionNode :: class : // To keep expressions from running against each other, we pad all expressions but the first if ( $ previousNodeWasExpression ) { $ transpiledView .= ' ' ; } $ transpiledView .= $ this -> transpileExpressionNode ( $ childNode ) ; $ previousNodeWasExpression = true ; break ; default : throw new RuntimeException ( sprintf ( 'Unknown node class %s' , get_class ( $ childNode ) ) ) ; } } return $ transpiledView ; }
Transpiles all nodes in an abstract syntax tree

@param AbstractSyntaxTree $ast The abstract syntax tree to transpile
@return string The view with transpiled nodes
@throws RuntimeException Thrown if the nodes could not be transpiled
Transpiles all nodes in an abstract syntax tree