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_Body extends Twig_Extensions_Grammar
16{
17    protected $end;
18
19    public function __construct($name, $end = null)
20    {
21        parent::__construct($name);
22
23        $this->end = null === $end ? 'end'.$name : $end;
24    }
25
26    public function __toString()
27    {
28        return sprintf('<%s:body>', $this->name);
29    }
30
31    public function parse(Twig_Token $token)
32    {
33        $stream = $this->parser->getStream();
34        $stream->expect(Twig_Token::BLOCK_END_TYPE);
35
36        return $this->parser->subparse(array($this, 'decideBlockEnd'), true);
37    }
38
39    public function decideBlockEnd(Twig_Token $token)
40    {
41        return $token->test($this->end);
42    }
43}
44