1<?php 2 3/* 4 * This file is part of Twig. 5 * 6 * (c) Fabien Potencier 7 * 8 * For the full copyright and license information, please view the LICENSE 9 * file that was distributed with this source code. 10 */ 11 12namespace Twig\Profiler\Node; 13 14use Twig\Attribute\YieldReady; 15use Twig\Compiler; 16use Twig\Node\Node; 17 18/** 19 * Represents a profile leave node. 20 * 21 * @author Fabien Potencier <fabien@symfony.com> 22 */ 23#[YieldReady] 24class LeaveProfileNode extends Node 25{ 26 public function __construct(string $varName) 27 { 28 parent::__construct([], ['var_name' => $varName]); 29 } 30 31 public function compile(Compiler $compiler): void 32 { 33 $compiler 34 ->write("\n") 35 ->write(\sprintf("\$%s->leave(\$%s);\n\n", $this->getAttribute('var_name'), $this->getAttribute('var_name').'_prof')) 36 ; 37 } 38} 39