You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Constant.php 769B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. /*
  3. * This file is part of Twig.
  4. *
  5. * (c) 2010 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. class Twig_Extensions_Grammar_Constant extends Twig_Extensions_Grammar
  11. {
  12. protected $type;
  13. public function __construct($name, $type = null)
  14. {
  15. $this->name = $name;
  16. $this->type = null === $type ? Twig_Token::NAME_TYPE : $type;
  17. }
  18. public function __toString()
  19. {
  20. return $this->name;
  21. }
  22. public function parse(Twig_Token $token)
  23. {
  24. $this->parser->getStream()->expect($this->type, $this->name);
  25. return $this->name;
  26. }
  27. public function getType()
  28. {
  29. return $this->type;
  30. }
  31. }