class SandboxNode
Represents a sandbox node.
@author Fabien Potencier <fabien@symfony.com>
Hierarchy
- class \Twig\Node\Node implements \Twig\Node\Countable, \Twig\Node\IteratorAggregate
- class \Twig\Node\SandboxNode extends \Twig\Node\Node
Expanded class hierarchy of SandboxNode
1 file declares its use of SandboxNode
- SandboxTokenParser.php in vendor/
twig/ twig/ src/ TokenParser/ SandboxTokenParser.php
File
-
vendor/
twig/ twig/ src/ Node/ SandboxNode.php, line 22
Namespace
Twig\NodeView source
class SandboxNode extends Node {
public function __construct(Node $body, int $lineno) {
parent::__construct([
'body' => $body,
], [], $lineno);
}
public function compile(Compiler $compiler) : void {
$compiler->addDebugInfo($this)
->write("if (!\$alreadySandboxed = \$this->sandbox->isSandboxed()) {\n")
->indent()
->write("\$this->sandbox->enableSandbox();\n")
->outdent()
->write("}\n")
->write("try {\n")
->indent()
->subcompile($this->getNode('body'))
->outdent()
->write("} finally {\n")
->indent()
->write("if (!\$alreadySandboxed) {\n")
->indent()
->write("\$this->sandbox->disableSandbox();\n")
->outdent()
->write("}\n")
->outdent()
->write("}\n");
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title | Overrides |
---|---|---|---|---|---|
Node::$attributeNameDeprecations | private | property | @var array<string, NameDeprecation> | ||
Node::$attributes | protected | property | |||
Node::$lineno | protected | property | |||
Node::$nodeNameDeprecations | private | property | @var array<string, NameDeprecation> | ||
Node::$nodes | protected | property | |||
Node::$sourceContext | private | property | |||
Node::$tag | protected | property | |||
Node::count | public | function | |||
Node::deprecateAttribute | public | function | |||
Node::deprecateNode | public | function | |||
Node::getAttribute | public | function | |||
Node::getIterator | public | function | |||
Node::getNode | public | function | |||
Node::getNodeTag | public | function | |||
Node::getSourceContext | public | function | |||
Node::getTemplateLine | public | function | |||
Node::getTemplateName | public | function | |||
Node::hasAttribute | public | function | |||
Node::hasNode | public | function | |||
Node::removeAttribute | public | function | |||
Node::removeNode | public | function | |||
Node::setAttribute | public | function | |||
Node::setNode | public | function | 1 | ||
Node::setNodeTag | public | function | @internal | ||
Node::setSourceContext | public | function | |||
Node::__toString | public | function | |||
SandboxNode::compile | public | function | Overrides Node::compile | ||
SandboxNode::__construct | public | function | Overrides Node::__construct |