本文整理汇总了PHP中Twig_Parser::getParent方法的典型用法代码示例。如果您正苦于以下问题:PHP Twig_Parser::getParent方法的具体用法?PHP Twig_Parser::getParent怎么用?PHP Twig_Parser::getParent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Twig_Parser
的用法示例。
在下文中一共展示了Twig_Parser::getParent方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testParseIsReentrant
public function testParseIsReentrant()
{
$twig = new Twig_Environment($this->getMock('Twig_LoaderInterface'), array('autoescape' => false, 'optimizations' => 0));
$twig->addTokenParser(new TestTokenParser());
$parser = new Twig_Parser($twig);
$parser->parse(new Twig_TokenStream(array(new Twig_Token(Twig_Token::BLOCK_START_TYPE, '', 1), new Twig_Token(Twig_Token::NAME_TYPE, 'test', 1), new Twig_Token(Twig_Token::BLOCK_END_TYPE, '', 1), new Twig_Token(Twig_Token::VAR_START_TYPE, '', 1), new Twig_Token(Twig_Token::NAME_TYPE, 'foo', 1), new Twig_Token(Twig_Token::VAR_END_TYPE, '', 1), new Twig_Token(Twig_Token::EOF_TYPE, '', 1))));
$this->assertNull($parser->getParent());
}
示例2: testParseIsReentrant
public function testParseIsReentrant()
{
$twig = new Twig_Environment(null, ['autoescape' => false, 'optimizations' => 0]);
$twig->addTokenParser(new TestTokenParser());
$parser = new Twig_Parser($twig);
$parser->parse(new Twig_TokenStream([new Twig_Token(Twig_Token::BLOCK_START_TYPE, '', 1), new Twig_Token(Twig_Token::NAME_TYPE, 'test', 1), new Twig_Token(Twig_Token::BLOCK_END_TYPE, '', 1), new Twig_Token(Twig_Token::VAR_START_TYPE, '', 1), new Twig_Token(Twig_Token::NAME_TYPE, 'foo', 1), new Twig_Token(Twig_Token::VAR_END_TYPE, '', 1), new Twig_Token(Twig_Token::EOF_TYPE, '', 1)]));
$this->assertNull($parser->getParent());
}