ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
Constant.php
Go to the documentation of this file.
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
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}
An exception for terminatinating execution or to throw for unit testing.
parse(Twig_Token $token)
Definition: Constant.php:30
__construct($name, $type=null)
Definition: Constant.php:19
Represents a Token.
Definition: Token.php:21
const NAME_TYPE
Definition: Token.php:32