Exemplo n.º 1
0
 public function __construct(Twig_Node_Expression $node, $name, $lineno)
 {
     parent::__construct(array('node' => $node), array('name' => $name, 'safe' => false), $lineno);
     if ($node instanceof Twig_Node_Expression_Name) {
         $node->setAttribute('always_defined', true);
     }
 }
Exemplo n.º 2
0
 public function addElement(Twig_Node_Expression $value, Twig_Node_Expression $key = null)
 {
     if (null === $key) {
         $key = new Twig_Node_Expression_Constant(++$this->index, $value->getLine());
     }
     array_push($this->nodes, $key, $value);
 }
Exemplo n.º 3
0
 public function __construct(Twig_Node_Expression $node, $method, Twig_Node_Expression_Array $arguments, $lineno)
 {
     parent::__construct(array('node' => $node, 'arguments' => $arguments), array('method' => $method, 'safe' => false), $lineno);
     if ($node instanceof Twig_Node_Expression_Name) {
         $node->setAttribute('always_defined', true);
     }
 }
Exemplo n.º 4
0
 public function __construct(Twig_Node_Expression $expr1, Twig_Node_Expression $expr2, Twig_Node_Expression $expr3, $lineno)
 {
     parent::__construct($lineno);
     $this->expr1 = $expr1;
     $this->expr2 = $expr2;
     $this->expr3 = $expr3;
 }
Exemplo n.º 5
0
 public function __construct(Twig_Node $node, $attr, $arguments, $lineno, $token_value)
 {
     parent::__construct($lineno);
     $this->node = $node;
     $this->attr = $attr;
     $this->arguments = $arguments;
     $this->token_value = $token_value;
 }
Exemplo n.º 6
0
 public function __construct(Twig_Node_Expression $node, Twig_Node_Expression $attribute, Twig_Node_Expression $arguments = null, $type, $lineno)
 {
     $nodes = array('node' => $node, 'attribute' => $attribute);
     if (null !== $arguments) {
         $nodes['arguments'] = $arguments;
     }
     parent::__construct($nodes, array('type' => $type, 'is_defined_test' => false, 'ignore_strict_check' => false, 'disable_c_ext' => false), $lineno);
 }
 public function __construct(Twig_Node_Expression_Filter $node)
 {
     if (!self::isDefaultFilter($node)) {
         throw new Twig_Error('The default filter node cannot be created from the given node.', $node->getLine());
     }
     $test = new Twig_Node_Expression_Test(clone $node->getNode('node'), 'defined', new Twig_Node(), $node->getLine());
     $default = count($node->getNode('arguments')) ? $node->getNode('arguments')->getNode(0) : new Twig_Node_Expression_Constant('', $node->getLine());
     $node = new Twig_Node_Expression_Conditional($test, $node, $default, $node->getLine());
     parent::__construct(array('node' => $node), array(), $node->getLine());
 }
Exemplo n.º 8
0
 /**
  * @param Twig_Node|null $template
  */
 public function __construct(Twig_NodeInterface $name, $template = null, $lineno, $tag = null)
 {
     if (is_bool($template)) {
         @trigger_error(sprintf('The %s method "$asString" argument is deprecated since version 1.28 and will be removed in 2.0.', __METHOD__), E_USER_DEPRECATED);
         $template = null;
     }
     $nodes = array('name' => $name);
     if (null !== $template) {
         $nodes['template'] = $template;
     }
     parent::__construct($nodes, array('is_defined_test' => false, 'output' => false), $lineno, $tag);
 }
Exemplo n.º 9
0
 public function __construct(Twig_NodeInterface $node, $name, Twig_NodeInterface $arguments = null, $lineno)
 {
     parent::__construct(array('node' => $node, 'arguments' => $arguments), array('name' => $name), $lineno);
     // defined is a special case
     if ('defined' === $name) {
         if ($node instanceof Twig_Node_Expression_Name || $node instanceof Twig_Node_Expression_GetAttr) {
             $node->setAttribute('is_defined_test', true);
         } else {
             throw new Twig_Error_Syntax('The "defined" test only works with simple variables', $this->getLine());
         }
     }
 }
Exemplo n.º 10
0
 public function __construct(\Twig_Node $left, \Twig_Node $right, $lineno)
 {
     $arguments = [];
     foreach ([$left, $right] as $node) {
         if ($node instanceof Arguments) {
             $arguments[] = $node->getArguments();
         } elseif ($node instanceof \Twig_Node_Expression_Name) {
             $arguments[] = [$node->getAttribute('name')];
         } else {
             throw new \InvalidArgumentException('Invalid argument.');
         }
     }
     $this->arguments = array_merge($arguments[0], $arguments[1]);
     parent::__construct(array('left' => $left, 'right' => $right), array(), $lineno);
 }
Exemplo n.º 11
0
 public function __construct($name, $lineno)
 {
     parent::__construct(array(), array('name' => $name, 'is_defined_test' => false), $lineno);
 }
Exemplo n.º 12
0
 public function __construct(Twig_Node_Expression $node, Twig_Node_Expression $attribute, Twig_Node_Expression $arguments = null, $type, $lineno)
 {
     parent::__construct(array('node' => $node, 'attribute' => $attribute, 'arguments' => $arguments), array('type' => $type, 'is_defined_test' => false, 'ignore_strict_check' => false, 'disable_c_ext' => true), $lineno);
 }
 /**
  * Constructor.
  *
  * @param \Twig_Node_Expression $variables
  * @param int                   $lineno
  * @param string                $tag
  */
 public function __construct(\Twig_Node_Expression $variables, $lineno, $tag = null)
 {
     $attr = array('variables' => $variables);
     parent::__construct(array(), $attr, $lineno, $tag);
 }
Exemplo n.º 14
0
 public function __construct($name, $lineno)
 {
     parent::__construct(array(), array('name' => $name, 'is_defined_test' => false, 'ignore_strict_check' => false, 'always_defined' => false), $lineno);
 }
Exemplo n.º 15
0
 public function __construct($elements, $lineno)
 {
     parent::__construct($lineno);
     $this->elements = $elements;
 }
Exemplo n.º 16
0
 public function __construct(Twig_NodeInterface $left, Twig_NodeInterface $right, $lineno)
 {
     parent::__construct(array('left' => $left, 'right' => $right), array(), $lineno);
 }
Exemplo n.º 17
0
 public function __construct(Twig_NodeInterface $node, $name, Twig_NodeInterface $arguments = null, $lineno)
 {
     parent::__construct(array('node' => $node, 'arguments' => $arguments), array('name' => $name), $lineno);
 }
Exemplo n.º 18
0
 public function __construct(Twig_NodeInterface $name, $asString = false, $lineno, $tag = null)
 {
     parent::__construct(array('name' => $name), array('as_string' => $asString, 'output' => false), $lineno, $tag);
 }
Exemplo n.º 19
0
 public function __construct($name, $lineno)
 {
     parent::__construct($lineno);
     $this->name = $name;
 }
Exemplo n.º 20
0
 public function __construct(Twig_Node $node, array $filters, $lineno, $tag = null)
 {
     parent::__construct($lineno, $tag);
     $this->node = $node;
     $this->filters = $filters;
 }
Exemplo n.º 21
0
 public function __construct(Twig_NodeInterface $left, Twig_NodeInterface $right, $lineno)
 {
     parent::__construct($lineno);
     $this->left = $left;
     $this->right = $right;
 }
Exemplo n.º 22
0
 public function __construct(Twig_NodeInterface $node, $lineno)
 {
     parent::__construct(array('node' => $node), array(), $lineno);
 }
Exemplo n.º 23
0
 public function __construct(Twig_Node_Expression_Name $name, Twig_NodeInterface $arguments, $lineno)
 {
     parent::__construct(array('name' => $name, 'arguments' => $arguments), array(), $lineno);
 }
Exemplo n.º 24
0
 public function __construct(Twig_NodeInterface $name, $lineno, $tag = null)
 {
     parent::__construct(array('name' => $name), array(), $lineno, $tag);
 }
Exemplo n.º 25
0
 public function __construct($name, $lineno)
 {
     parent::__construct(array(), array('name' => $name), $lineno);
 }
Exemplo n.º 26
0
 public function __construct($value, $lineno)
 {
     parent::__construct(array(), array('value' => $value), $lineno);
 }
Exemplo n.º 27
0
 public function __construct(Twig_Node $node, $lineno)
 {
     parent::__construct($lineno);
     $this->node = $node;
 }
Exemplo n.º 28
0
 public function __construct(Twig_NodeInterface $node, Twig_Node_Expression_Constant $filterName, Twig_NodeInterface $arguments, $lineno, $tag = null)
 {
     parent::__construct(array('node' => $node, 'filter' => $filterName, 'arguments' => $arguments), array(), $lineno, $tag);
 }
Exemplo n.º 29
0
 public function __construct($name, $lineno, $tag = null)
 {
     parent::__construct(array(), array('output' => false, 'name' => $name), $lineno, $tag);
 }
Exemplo n.º 30
0
 public function __construct(Twig_Node_Expression $expr1, Twig_Node_Expression $expr2, Twig_Node_Expression $expr3, $lineno)
 {
     parent::__construct(array('expr1' => $expr1, 'expr2' => $expr2, 'expr3' => $expr3), array(), $lineno);
 }