本文整理汇总了PHP中ezcTemplateSourceToTstParser::parse方法的典型用法代码示例。如果您正苦于以下问题:PHP ezcTemplateSourceToTstParser::parse方法的具体用法?PHP ezcTemplateSourceToTstParser::parse怎么用?PHP ezcTemplateSourceToTstParser::parse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ezcTemplateSourceToTstParser
的用法示例。
在下文中一共展示了ezcTemplateSourceToTstParser::parse方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: parseRequiredType
/**
* Parses a required type.
*
* @param mixed $type
* @param ezcTemplateCursor $startCursor
* @param bool $mergeElements
* @return bool
*/
protected function parseRequiredType($type, ezcTemplateCursor $startCursor = null, $mergeElements = true)
{
if (is_string($type)) {
$className = 'ezcTemplate' . $type . 'SourceToTstParser';
if (!ezcBaseFeatures::classExists($className)) {
throw new ezcTemplateInternalException("Could instantiate sub-parser for type <{$type}>, the class <{$className}> does not exist");
}
$this->subParser = new $className($this->parser, $this, $startCursor);
} else {
if (is_object($type) && $type instanceof ezcTemplateSourceToTstParser) {
$this->subParser = $type;
} else {
throw new ezcTemplateInternalException("Cannot use <" . gettype($type) . "> as parser in ezcTemplateSourceToTstParser::parseRequiredType()");
}
}
$this->lastParser = $this->subParser;
$this->subParser->parse();
if ($this->subParser->status == self::PARSE_SUCCESS) {
$this->currentCursor->copy($this->subParser->endCursor);
$this->lastCursor->copy($this->currentCursor);
if ($mergeElements) {
$this->mergeElements($this->subParser);
}
$this->subParser = null;
return true;
} elseif ($this->subParser->status === self::PARSE_PARTIAL_SUCCESS) {
$this->status = $this->subParser->status;
return false;
}
return false;
}