You are here

protected function Twig_NodeVisitor_SafeAnalysis::setSafe in Translation template extractor 6.3

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

File

vendor/Twig/NodeVisitor/SafeAnalysis.php, line 33

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,
  );
}