Ejemplo n.º 1
0
 /**
  * @param Node $node
  * @param      $for
  */
 private function addFilterNode(Node $node, $for)
 {
     if (!$this->environment->hasFunction('filter_' . $for)) {
         $for = $this->defaultAutofilterStrategy;
     }
     $node->addChild(new FunctionNode('filter_' . $for, [$node->getChild('expression')]), 'expression');
 }
Ejemplo n.º 2
0
function template_function_filter(Environment $environment, $data, $for = 'html')
{
    if (!is_string($data)) {
        return $data;
    }
    if (!$environment->hasFunction('filter_' . $for)) {
        $for = $environment->getOption('default_autofilter_strategy');
    }
    return $environment->getFunction('filter_' . $for)->call($data);
}
Ejemplo n.º 3
0
 /**
  * @dataProvider functionProvider
  */
 public function testFunctionsAreAddedToEnvironment($function)
 {
     $this->assertTrue($this->env->hasFunction($function));
 }