You are here

protected function Twig_NodeVisitor_SafeAnalysis::setSafe in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/twig/twig/lib/Twig/NodeVisitor/SafeAnalysis.php \Twig_NodeVisitor_SafeAnalysis::setSafe()
1 call to Twig_NodeVisitor_SafeAnalysis::setSafe()
Twig_NodeVisitor_SafeAnalysis::doLeaveNode in vendor/twig/twig/lib/Twig/NodeVisitor/SafeAnalysis.php
Called after child nodes are visited.

File

vendor/twig/twig/lib/Twig/NodeVisitor/SafeAnalysis.php, line 42

Class

Twig_NodeVisitor_SafeAnalysis

Code

protected function setSafe(Twig_NodeInterface $node, array $safe) {
  $hash = spl_object_hash($node);
  if (isset($this->data[$hash])) {
    foreach ($this->data[$hash] as &$bucket) {
      if ($bucket['key'] === $node) {
        $bucket['value'] = $safe;
        return;
      }
    }
  }
  $this->data[$hash][] = array(
    'key' => $node,
    'value' => $safe,
  );
}