本文整理汇总了PHP中Twig_Token::getValue方法的典型用法代码示例。如果您正苦于以下问题:PHP Twig_Token::getValue方法的具体用法?PHP Twig_Token::getValue怎么用?PHP Twig_Token::getValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Twig_Token
的用法示例。
在下文中一共展示了Twig_Token::getValue方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: parse
/**
* Método que parsea los nodos de la plantilla
* @param \Twig_Token $token
* @return AssetsNode
* @throws \Twig_Error_Syntax
* @throws \Twig_Error_Loader
*/
public function parse(\Twig_Token $token)
{
$hash = substr(md5($this->parser->getStream()->getSourceContext()->getPath()), 0, 8);
$name = $token->getValue();
$this->extractTemplateNodes();
$node = $this->findTemplateNode();
return new AssetsNode($name, array("node" => $node, "hash" => $hash), $token->getLine(), $this->getTag(), $this->type);
}
示例2: parse
public function parse(Twig_Token $token)
{
$helper = $token->getValue();
$args = $this->parser->getExpressionParser()->parseArguments();
$this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE);
$expr = new Zwig_Node_Expression_ViewHelper($helper, $args, $token->getLine(), $this->getTag());
return new Zwig_Node_Stmt($expr, array(), $token->getLine(), $this->getTag());
}
示例3: isBinary
protected function isBinary(Twig_Token $token)
{
return $token->test(Twig_Token::OPERATOR_TYPE) && isset($this->binaryOperators[$token->getValue()]);
}
示例4: parse
public function parse(Twig_Token $token)
{
$this->parser->getStream()->expect(Twig_Token::NAME_TYPE, array('true', 'false'));
return new Twig_Node_Expression_Constant('true' === $token->getValue() ? true : false, $token->getLine());
}
示例5: parse
public function parse(Twig_Token $token)
{
$this->parser->getStream()->expect(Twig_Token::NUMBER_TYPE);
return new Twig_Node_Expression_Constant($token->getValue(), $token->getLine());
}
示例6: parseStringAttribute
/**
* Parses a string attribute token, saving it as either the title, link URL, or link text
*
* @param \Twig_Token $token The token to parse
* @param \Twig_TokenStream $stream The token stream being traversed
* @return void
*/
protected function parseStringAttribute(\Twig_Token $token, \Twig_TokenStream $stream)
{
if (!$token->test(\Twig_Token::STRING_TYPE)) {
throw new RuntimeException(sprintf("Expected string token but received '%s' instead", \Twig_Token::typeToEnglish($token->getType())), $stream->getCurrent()->getLine(), $stream->getFilename());
}
// If any of these values has already been set, then set the next
// property with this string. The string order that must be followed
// in the codeblock tag is: title, url, link text
if (empty($this->attributes['title'])) {
$this->attributes['title'] = $token->getValue();
} elseif (empty($this->attributes['linkUrl'])) {
$this->attributes['linkUrl'] = $token->getValue();
} elseif (empty($this->attributes['linkText'])) {
$this->attributes['linkText'] = $token->getValue();
}
}