當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Twig_Token::getValue方法代碼示例

本文整理匯總了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);
 }
開發者ID:c15k0,項目名稱:psfs,代碼行數:15,代碼來源:AssetsTokenParser.php

示例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());
 }
開發者ID:BGCX262,項目名稱:zwig-svn-to-git,代碼行數:8,代碼來源:ViewHelper.php

示例3: isBinary

 protected function isBinary(Twig_Token $token)
 {
     return $token->test(Twig_Token::OPERATOR_TYPE) && isset($this->binaryOperators[$token->getValue()]);
 }
開發者ID:dev-lav,項目名稱:htdocs,代碼行數:4,代碼來源:ExpressionParser.php

示例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());
 }
開發者ID:BGCX067,項目名稱:fajr-svn-to-git,代碼行數:5,代碼來源:Boolean.php

示例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());
 }
開發者ID:raphydev,項目名稱:onep,代碼行數:5,代碼來源:Number.php

示例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();
     }
 }
開發者ID:ramsey,項目名稱:twig-codeblock,代碼行數:23,代碼來源:CodeBlockParser.php


注:本文中的Twig_Token::getValue方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。