You are here

protected function Twig_NodeVisitor_Escaper::isSafeFor in Translation template extractor 7.3

Same name and namespace in other branches
  1. 6.3 vendor/Twig/NodeVisitor/Escaper.php \Twig_NodeVisitor_Escaper::isSafeFor()
2 calls to Twig_NodeVisitor_Escaper::isSafeFor()
Twig_NodeVisitor_Escaper::escapePrintNode in vendor/Twig/NodeVisitor/Escaper.php
Twig_NodeVisitor_Escaper::preEscapeFilterNode in vendor/Twig/NodeVisitor/Escaper.php

File

vendor/Twig/NodeVisitor/Escaper.php, line 114

Class

Twig_NodeVisitor_Escaper
Twig_NodeVisitor_Escaper implements output escaping.

Code

protected function isSafeFor($type, Twig_NodeInterface $expression, $env) {
  $safe = $this->safeAnalysis
    ->getSafe($expression);
  if (null === $safe) {
    if (null === $this->traverser) {
      $this->traverser = new Twig_NodeTraverser($env, array(
        $this->safeAnalysis,
      ));
    }
    $this->safeAnalysis
      ->setSafeVars($this->safeVars);
    $this->traverser
      ->traverse($expression);
    $safe = $this->safeAnalysis
      ->getSafe($expression);
  }
  return in_array($type, $safe) || in_array('all', $safe);
}