EnterProfileNode.php

Same filename in this branch
  1. 11.x core/modules/sdc/tests/modules/sdc_other_node_visitor/src/Twig/Profiler/EnterProfileNode.php
Same filename in other branches
  1. 10 core/modules/sdc/tests/modules/sdc_other_node_visitor/src/Twig/Profiler/EnterProfileNode.php
  2. 10 core/modules/system/tests/modules/sdc_other_node_visitor/src/Twig/Profiler/EnterProfileNode.php

Namespace

Drupal\sdc_other_node_visitor\Twig\Profiler

File

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

View source
<?php

declare (strict_types=1);
namespace Drupal\sdc_other_node_visitor\Twig\Profiler;

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

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

}

Classes

Title Deprecated Summary
EnterProfileNode Represents a profile enter node.

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