1<?php 2 3/* 4 * This file is part of Twig. 5 * 6 * (c) 2010 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 * @deprecated since version 1.5 14 */ 15class Twig_Extensions_Grammar_Constant extends Twig_Extensions_Grammar 16{ 17 protected $type; 18 19 public function __construct($name, $type = null) 20 { 21 $this->name = $name; 22 $this->type = null === $type ? Twig_Token::NAME_TYPE : $type; 23 } 24 25 public function __toString() 26 { 27 return $this->name; 28 } 29 30 public function parse(Twig_Token $token) 31 { 32 $this->parser->getStream()->expect($this->type, $this->name); 33 34 return $this->name; 35 } 36 37 public function getType() 38 { 39 return $this->type; 40 } 41} 42