27 $hash = spl_object_hash($node);
28 if (!isset($this->
data[$hash])) {
32 foreach ($this->
data[$hash] as $bucket) {
33 if ($bucket[
'key'] !== $node) {
37 if (in_array(
'html_attr', $bucket[
'value'])) {
38 $bucket[
'value'][] =
'html';
41 return $bucket[
'value'];
47 $hash = spl_object_hash($node);
48 if (isset($this->
data[$hash])) {
49 foreach ($this->
data[$hash] as &$bucket) {
50 if ($bucket[
'key'] === $node) {
51 $bucket[
'value'] = $safe;
57 $this->
data[$hash][] = array(
72 $this->
setSafe($node, array(
'all'));
75 $this->
setSafe($node, array(
'all'));
78 $this->
setSafe($node, array(
'all'));
86 $args = $node->
getNode(
'arguments');
88 $safe = $filter->getSafe($args);
99 $args = $node->
getNode(
'arguments');
101 if (
false !== $function) {
102 $this->
setSafe($node, $function->getSafe($args));
104 $this->
setSafe($node, array());
108 $this->
setSafe($node, array(
'all'));
110 $this->
setSafe($node, array());
115 if (
'_self' ==
$name || in_array(
$name, $this->safeVars)) {
116 $this->
setSafe($node, array(
'all'));
118 $this->
setSafe($node, array());
121 $this->
setSafe($node, array());
129 if (null === $a || null === $b) {
133 if (in_array(
'all', $a)) {
137 if (in_array(
'all', $b)) {
141 return array_intersect($a, $b);
150 class_alias(
'Twig_NodeVisitor_SafeAnalysis',
'Twig\NodeVisitor\SafeAnalysisNodeVisitor',
false);
Represents a node in the AST.
getPriority()
Returns the priority for this visitor.
Represents a node in the AST.
getFilter($name)
Get a filter by name.
getFunction($name)
Get a function by name.
Represents a parent node.
Twig_BaseNodeVisitor can be used to make node visitors compatible with Twig 1.x and 2...
doLeaveNode(Twig_Node $node, Twig_Environment $env)
doEnterNode(Twig_Node $node, Twig_Environment $env)
Represents a block call node.
Stores the Twig configuration.
getSafe(Twig_NodeInterface $node)
setSafe(Twig_NodeInterface $node, array $safe)
intersectSafe(array $a=null, array $b=null)