Пример #1
0
 /**
  * Removes node filters.
  *
  * This is mostly needed when another visitor adds filters (like the escaper one).
  *
  * @param IfwPsn_Vendor_Twig_Node $node A Node
  */
 protected function removeNodeFilter($node)
 {
     if ($node instanceof IfwPsn_Vendor_Twig_Node_Expression_Filter) {
         return $this->removeNodeFilter($node->getNode('node'));
     }
     return $node;
 }
Пример #2
0
 public function __construct(IfwPsn_Vendor_Twig_Node_Expression_AssignName $keyTarget, IfwPsn_Vendor_Twig_Node_Expression_AssignName $valueTarget, IfwPsn_Vendor_Twig_Node_Expression $seq, IfwPsn_Vendor_Twig_Node_Expression $ifexpr = null, IfwPsn_Vendor_Twig_NodeInterface $body, IfwPsn_Vendor_Twig_NodeInterface $else = null, $lineno, $tag = null)
 {
     $body = new IfwPsn_Vendor_Twig_Node(array($body, $this->loop = new IfwPsn_Vendor_Twig_Node_ForLoop($lineno, $tag)));
     if (null !== $ifexpr) {
         $body = new IfwPsn_Vendor_Twig_Node_If(new IfwPsn_Vendor_Twig_Node(array($ifexpr, $body)), null, $lineno, $tag);
     }
     parent::__construct(array('key_target' => $keyTarget, 'value_target' => $valueTarget, 'seq' => $seq, 'body' => $body, 'else' => $else), array('with_loop' => true, 'ifexpr' => null !== $ifexpr), $lineno, $tag);
 }
Пример #3
0
 public function __construct($capture, IfwPsn_Vendor_Twig_NodeInterface $names, IfwPsn_Vendor_Twig_NodeInterface $values, $lineno, $tag = null)
 {
     parent::__construct(array('names' => $names, 'values' => $values), array('capture' => $capture, 'safe' => false), $lineno, $tag);
     /*
      * Optimizes the node when capture is used for a large block of text.
      *
      * {% set foo %}foo{% endset %} is compiled to $context['foo'] = new IfwPsn_Vendor_Twig_Markup("foo");
      */
     if ($this->getAttribute('capture')) {
         $this->setAttribute('safe', true);
         $values = $this->getNode('values');
         if ($values instanceof IfwPsn_Vendor_Twig_Node_Text) {
             $this->setNode('values', new IfwPsn_Vendor_Twig_Node_Expression_Constant($values->getAttribute('data'), $values->getLine()));
             $this->setAttribute('capture', false);
         }
     }
 }
Пример #4
0
 public function __construct(IfwPsn_Vendor_Twig_NodeInterface $tests, IfwPsn_Vendor_Twig_NodeInterface $else = null, $lineno, $tag = null)
 {
     parent::__construct(array('tests' => $tests, 'else' => $else), array(), $lineno, $tag);
 }
Пример #5
0
 public function __construct($name, $lineno)
 {
     parent::__construct(array(), array('name' => $name), $lineno);
 }
Пример #6
0
 public function __construct($lineno, $tag = null)
 {
     parent::__construct(array(), array('with_loop' => false, 'ifexpr' => false, 'else' => false), $lineno, $tag);
 }
Пример #7
0
 public function __construct($name, IfwPsn_Vendor_Twig_NodeInterface $body, $lineno, $tag = null)
 {
     parent::__construct(array('body' => $body), array('name' => $name), $lineno, $tag);
 }
Пример #8
0
 public function __construct(IfwPsn_Vendor_Twig_Node_Expression $expr, IfwPsn_Vendor_Twig_Node_Expression $variables = null, $only = false, $ignoreMissing = false, $lineno, $tag = null)
 {
     parent::__construct(array('expr' => $expr, 'variables' => $variables), array('only' => (bool) $only, 'ignore_missing' => (bool) $ignoreMissing), $lineno, $tag);
 }
Пример #9
0
 public function __construct(IfwPsn_Vendor_Twig_NodeInterface $body, $lineno, $tag = 'spaceless')
 {
     parent::__construct(array('body' => $body), array(), $lineno, $tag);
 }
Пример #10
0
 public function __construct($value, IfwPsn_Vendor_Twig_NodeInterface $body, $lineno, $tag = 'autoescape')
 {
     parent::__construct(array('body' => $body), array('value' => $value), $lineno, $tag);
 }
Пример #11
0
 public function __construct(IfwPsn_Vendor_Twig_NodeInterface $body, IfwPsn_Vendor_Twig_Node_Expression $parent = null, IfwPsn_Vendor_Twig_NodeInterface $blocks, IfwPsn_Vendor_Twig_NodeInterface $macros, IfwPsn_Vendor_Twig_NodeInterface $traits, $embeddedTemplates, $filename)
 {
     // embedded templates are set as attributes so that they are only visited once by the visitors
     parent::__construct(array('parent' => $parent, 'body' => $body, 'blocks' => $blocks, 'macros' => $macros, 'traits' => $traits), array('filename' => $filename, 'index' => null, 'embedded_templates' => $embeddedTemplates), 1);
 }
Пример #12
0
 public function __construct(IfwPsn_Vendor_Twig_Node_Expression $expr, $lineno, $tag = null)
 {
     parent::__construct(array('expr' => $expr), array(), $lineno, $tag);
 }
Пример #13
0
 public function __construct($lineno, $tag)
 {
     parent::__construct(array(), array(), $lineno, $tag);
 }
Пример #14
0
 public function __construct($data, $lineno)
 {
     parent::__construct(array(), array('data' => $data), $lineno);
 }