[ Index ] |
PHP Cross Reference of phpBB-3.2.11-deutsch |
[Summary view] [Print] [Text view]
1 <?php 2 3 /* 4 * This file is part of Twig. 5 * 6 * (c) Fabien Potencier 7 * (c) Armin Ronacher 8 * 9 * For the full copyright and license information, please view the LICENSE 10 * file that was distributed with this source code. 11 */ 12 13 namespace Twig\TokenParser; 14 15 use Twig\Error\SyntaxError; 16 use Twig\Node\Node; 17 use Twig\Token; 18 19 /** 20 * Extends a template by another one. 21 * 22 * {% extends "base.html" %} 23 * 24 * @final 25 */ 26 class ExtendsTokenParser extends AbstractTokenParser 27 { 28 public function parse(Token $token) 29 { 30 $stream = $this->parser->getStream(); 31 32 if ($this->parser->peekBlockStack()) { 33 throw new SyntaxError('Cannot use "extend" in a block.', $token->getLine(), $stream->getSourceContext()); 34 } elseif (!$this->parser->isMainScope()) { 35 throw new SyntaxError('Cannot use "extend" in a macro.', $token->getLine(), $stream->getSourceContext()); 36 } 37 38 if (null !== $this->parser->getParent()) { 39 throw new SyntaxError('Multiple extends tags are forbidden.', $token->getLine(), $stream->getSourceContext()); 40 } 41 $this->parser->setParent($this->parser->getExpressionParser()->parseExpression()); 42 43 $stream->expect(Token::BLOCK_END_TYPE); 44 45 return new Node(); 46 } 47 48 public function getTag() 49 { 50 return 'extends'; 51 } 52 } 53 54 class_alias('Twig\TokenParser\ExtendsTokenParser', 'Twig_TokenParser_Extends');
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Nov 11 20:33:01 2020 | Cross-referenced by PHPXref 0.7.1 |