1<?php
2
3/*
4 * This file is part of Twig.
5 *
6 * (c) Fabien Potencier
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Twig;
13
14/**
15 * Represents a template test.
16 *
17 * @final
18 *
19 * @author Fabien Potencier <fabien@symfony.com>
20 */
21class TwigTest
22{
23    protected $name;
24    protected $callable;
25    protected $options;
26
27    private $arguments = [];
28
29    public function __construct($name, $callable, array $options = [])
30    {
31        $this->name = $name;
32        $this->callable = $callable;
33        $this->options = array_merge([
34            'is_variadic' => false,
35            'node_class' => '\Twig\Node\Expression\TestExpression',
36            'deprecated' => false,
37            'alternative' => null,
38        ], $options);
39    }
40
41    public function getName()
42    {
43        return $this->name;
44    }
45
46    public function getCallable()
47    {
48        return $this->callable;
49    }
50
51    public function getNodeClass()
52    {
53        return $this->options['node_class'];
54    }
55
56    public function isVariadic()
57    {
58        return $this->options['is_variadic'];
59    }
60
61    public function isDeprecated()
62    {
63        return (bool) $this->options['deprecated'];
64    }
65
66    public function getDeprecatedVersion()
67    {
68        return $this->options['deprecated'];
69    }
70
71    public function getAlternative()
72    {
73        return $this->options['alternative'];
74    }
75
76    public function setArguments($arguments)
77    {
78        $this->arguments = $arguments;
79    }
80
81    public function getArguments()
82    {
83        return $this->arguments;
84    }
85}
86
87class_alias('Twig\TwigTest', 'Twig_SimpleTest');
88