LeaveProfileNode.php

Same filename in this branch
  1. 11.x core/modules/sdc/tests/modules/sdc_other_node_visitor/src/Twig/Profiler/LeaveProfileNode.php
Same filename and directory in other branches
  1. 10 core/modules/sdc/tests/modules/sdc_other_node_visitor/src/Twig/Profiler/LeaveProfileNode.php

Namespace

Drupal\sdc_other_node_visitor\Twig\Profiler

File

core/modules/system/tests/modules/sdc_other_node_visitor/src/Twig/Profiler/LeaveProfileNode.php

View source
<?php

namespace Drupal\sdc_other_node_visitor\Twig\Profiler;

use Twig\Attribute\YieldReady;
use Twig\Compiler;
use Twig\Node\Node;

/**
 * Represents a profile leave node.
 */
class LeaveProfileNode extends Node {
    public function __construct(string $varName) {
        parent::__construct([], [
            'var_name' => $varName,
        ]);
    }
    public function compile(Compiler $compiler) : void {
        $compiler->write("\n")
            ->write(sprintf("\$%s->leave();\n\n", $this->getAttribute('var_name')));
    }

}

Classes

Title Deprecated Summary
LeaveProfileNode Represents a profile leave node.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.