You are here

public function Twig_Node_SandboxedPrint::compile in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/twig/twig/lib/Twig/Node/SandboxedPrint.php \Twig_Node_SandboxedPrint::compile()

Compiles the node to PHP.

Parameters

Twig_Compiler $compiler A Twig_Compiler instance:

Overrides Twig_Node_Print::compile

File

vendor/twig/twig/lib/Twig/Node/SandboxedPrint.php, line 24

Class

Twig_Node_SandboxedPrint
Twig_Node_SandboxedPrint adds a check for the __toString() method when the variable is an object and the sandbox is activated.

Code

public function compile(Twig_Compiler $compiler) {
  $compiler
    ->addDebugInfo($this)
    ->write('echo $this->env->getExtension(\'sandbox\')->ensureToStringAllowed(')
    ->subcompile($this
    ->getNode('expr'))
    ->raw(");\n");
}