composer package updates
[openemr.git] / vendor / twig / twig / lib / Twig / Node / Expression / Test.php
blobad102ba60df5ae7737fede9bd9a483396b1727d5
1 <?php
3 /*
4 * This file is part of Twig.
6 * (c) Fabien Potencier
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
11 class Twig_Node_Expression_Test extends Twig_Node_Expression_Call
13 public function __construct(Twig_NodeInterface $node, $name, Twig_NodeInterface $arguments = null, $lineno)
15 $nodes = array('node' => $node);
16 if (null !== $arguments) {
17 $nodes['arguments'] = $arguments;
20 parent::__construct($nodes, array('name' => $name), $lineno);
23 public function compile(Twig_Compiler $compiler)
25 $name = $this->getAttribute('name');
26 $test = $compiler->getEnvironment()->getTest($name);
28 $this->setAttribute('name', $name);
29 $this->setAttribute('type', 'test');
30 $this->setAttribute('thing', $test);
31 if ($test instanceof Twig_TestCallableInterface || $test instanceof Twig_SimpleTest) {
32 $this->setAttribute('callable', $test->getCallable());
34 if ($test instanceof Twig_SimpleTest) {
35 $this->setAttribute('is_variadic', $test->isVariadic());
38 $this->compileCallable($compiler);
42 class_alias('Twig_Node_Expression_Test', 'Twig\Node\Expression\TestExpression', false);