本文整理汇总了PHP中ezcTemplateCursor::cursorAt方法的典型用法代码示例。如果您正苦于以下问题:PHP ezcTemplateCursor::cursorAt方法的具体用法?PHP ezcTemplateCursor::cursorAt怎么用?PHP ezcTemplateCursor::cursorAt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ezcTemplateCursor
的用法示例。
在下文中一共展示了ezcTemplateCursor::cursorAt方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: parseCurrent
/**
* Parses the comment by looking for the end marker * + }.
*
* @param ezcTemplateCursor $cursor
* @return bool
*/
protected function parseCurrent(ezcTemplateCursor $cursor)
{
$cursor->advance();
if ($cursor->atEnd()) {
return false;
}
$checkInlineComment = false;
// Check for a slash after the asterix, this typically means a typo for an inline comment
// Better give an error for this to warn the user.
if ($cursor->current() == '/') {
$checkInlineComment = true;
}
$endPosition = $cursor->findPosition('*}');
if ($endPosition === false) {
return false;
}
// If we found an end for an inline comment we need to check if there
// is an end for an inline comment
if ($checkInlineComment) {
$commentCursor = $cursor->cursorAt($cursor->position, $endPosition);
$commentCursor->advance();
$inlineCommentPosition = $commentCursor->findPosition('*/');
// We found the end of the inline comment, this is most likely a user error
if ($inlineCommentPosition !== false) {
$cursor->gotoPosition($inlineCommentPosition);
return false;
}
}
// reached end of comment
$cursor->gotoPosition($endPosition + 2);
$commentBlock = new ezcTemplateDocCommentTstNode($this->parser->source, clone $this->startCursor, clone $cursor);
$commentBlock->commentText = substr($commentBlock->text(), 2, -2);
$this->appendElement($commentBlock);
return true;
}