SimpleTest.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. /*
  3. * This file is part of Twig.
  4. *
  5. * (c) 2010-2012 Fabien Potencier
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. /**
  11. * Represents a template test.
  12. *
  13. * @author Fabien Potencier <fabien@symfony.com>
  14. */
  15. class Twig_SimpleTest
  16. {
  17. protected $name;
  18. protected $callable;
  19. protected $options;
  20. public function __construct($name, $callable, array $options = array())
  21. {
  22. $this->name = $name;
  23. $this->callable = $callable;
  24. $this->options = array_merge(array(
  25. 'is_variadic' => false,
  26. 'node_class' => 'Twig_Node_Expression_Test',
  27. 'deprecated' => false,
  28. 'alternative' => null,
  29. ), $options);
  30. }
  31. public function getName()
  32. {
  33. return $this->name;
  34. }
  35. public function getCallable()
  36. {
  37. return $this->callable;
  38. }
  39. public function getNodeClass()
  40. {
  41. return $this->options['node_class'];
  42. }
  43. public function isVariadic()
  44. {
  45. return $this->options['is_variadic'];
  46. }
  47. public function isDeprecated()
  48. {
  49. return (bool) $this->options['deprecated'];
  50. }
  51. public function getDeprecatedVersion()
  52. {
  53. return $this->options['deprecated'];
  54. }
  55. public function getAlternative()
  56. {
  57. return $this->options['alternative'];
  58. }
  59. }