Project

General

Profile

1
<?php
2

    
3
/*
4
 * This file is part of Twig.
5
 *
6
 * (c) 2010-2012 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

    
12
/**
13
 * Represents a template test.
14
 *
15
 * @author Fabien Potencier <fabien@symfony.com>
16
 */
17
class Twig_SimpleTest
18
{
19
    protected $name;
20
    protected $callable;
21
    protected $options;
22

    
23
    public function __construct($name, $callable, array $options = array())
24
    {
25
        $this->name = $name;
26
        $this->callable = $callable;
27
        $this->options = array_merge(array(
28
            'is_variadic' => false,
29
            'node_class' => 'Twig_Node_Expression_Test',
30
            'deprecated' => false,
31
            'alternative' => null,
32
        ), $options);
33
    }
34

    
35
    public function getName()
36
    {
37
        return $this->name;
38
    }
39

    
40
    public function getCallable()
41
    {
42
        return $this->callable;
43
    }
44

    
45
    public function getNodeClass()
46
    {
47
        return $this->options['node_class'];
48
    }
49

    
50
    public function isVariadic()
51
    {
52
        return $this->options['is_variadic'];
53
    }
54

    
55
    public function isDeprecated()
56
    {
57
        return (bool) $this->options['deprecated'];
58
    }
59

    
60
    public function getDeprecatedVersion()
61
    {
62
        return $this->options['deprecated'];
63
    }
64

    
65
    public function getAlternative()
66
    {
67
        return $this->options['alternative'];
68
    }
69
}
(32-32/43)