ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
Spaceless.php
Go to the documentation of this file.
1<?php
2
3/*
4 * This file is part of Twig.
5 *
6 * (c) 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
28{
29 public function parse(Twig_Token $token)
30 {
31 $lineno = $token->getLine();
32
33 $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE);
34 $body = $this->parser->subparse(array($this, 'decideSpacelessEnd'), true);
35 $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE);
36
37 return new Twig_Node_Spaceless($body, $lineno, $this->getTag());
38 }
39
40 public function decideSpacelessEnd(Twig_Token $token)
41 {
42 return $token->test('endspaceless');
43 }
44
45 public function getTag()
46 {
47 return 'spaceless';
48 }
49}
50
51class_alias('Twig_TokenParser_Spaceless', 'Twig\TokenParser\SpacelessTokenParser', false);
An exception for terminatinating execution or to throw for unit testing.
Represents a spaceless node.
Definition: Spaceless.php:20
Remove whitespaces between HTML tags.
Definition: Spaceless.php:28
decideSpacelessEnd(Twig_Token $token)
Definition: Spaceless.php:40
parse(Twig_Token $token)
Parses a token and returns a node.
Definition: Spaceless.php:29
getTag()
Gets the tag name associated with this token parser.
Definition: Spaceless.php:45
Base class for all token parsers.
Definition: TokenParser.php:18
Represents a Token.
Definition: Token.php:21
const BLOCK_END_TYPE
Definition: Token.php:30
getLine()
Definition: Token.php:87
test($type, $values=null)
Tests the current token for a type and/or a value.
Definition: Token.php:70