本文整理汇总了PHP中Twig_Parser::subparse方法的典型用法代码示例。如果您正苦于以下问题:PHP Twig_Parser::subparse方法的具体用法?PHP Twig_Parser::subparse怎么用?PHP Twig_Parser::subparse使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Twig_Parser
的用法示例。
在下文中一共展示了Twig_Parser::subparse方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: parseInline
private function parseInline(\Twig_TokenStream $stream, $lineno)
{
$stream->expect(\Twig_Token::BLOCK_END_TYPE);
$this->parser->subparse(function ($token) {
return $token->test(['end' . $this->getTag()]);
}, true);
$stream->expect(\Twig_Token::BLOCK_END_TYPE);
$file = $this->parser->getEnvironment()->getLoader()->getCacheKey($stream->getFilename());
if (!isset($this->inline_blocks[$file])) {
$this->inline_blocks[$file] = 0;
}
$file_name = md5($file . $this->inline_blocks[$file]) . ".js";
$assets = $this->extension->webpackAsset('cache.' . $file_name);
$this->inline_blocks[$file]++;
return new WebpackInlineNode(['js_file' => $assets['js'], 'css_file' => $assets['css']], $lineno, $this->getTag());
}
示例2: subparse
public function subparse($test, $dropNeedle = false)
{
if (!is_object($this->handlers)) {
$this->handlers = new Zwig_FallbackArray($this->handlers);
}
return parent::subparse($test, $dropNeedle);
}
示例3: parseOptionsTag
public function parseOptionsTag(\Twig_Parser $parser, $hasContent = true, $method = 'decideBlockEnd')
{
$options = array();
if (!$parser->getStream()->test(\Twig_Token::BLOCK_END_TYPE)) {
do {
$nameExpression = $this->parser->getExpressionParser()->parseExpression();
$name = $nameExpression->getAttribute('name');
$options['names'][$name] = $nameExpression;
$parser->getStream()->expect(\Twig_Token::OPERATOR_TYPE, '=');
$options['values'][$name] = $parser->getExpressionParser()->parseExpression();
} while (!$parser->getStream()->test(\Twig_Token::BLOCK_END_TYPE));
}
if ($hasContent) {
$parser->getStream()->expect(\Twig_Token::BLOCK_END_TYPE);
$options['content'] = $parser->subparse(array($this, $method), true);
}
$parser->getStream()->expect(\Twig_Token::BLOCK_END_TYPE);
return $options;
}