本文整理汇总了PHP中Sabre\VObject\Component::createComponent方法的典型用法代码示例。如果您正苦于以下问题:PHP Component::createComponent方法的具体用法?PHP Component::createComponent怎么用?PHP Component::createComponent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sabre\VObject\Component
的用法示例。
在下文中一共展示了Component::createComponent方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: parseLine
/**
* Parses a line, and if it hits a component, it will also attempt to parse
* the entire component.
*
* @param string $line Unfolded line
*
* @return Node
*/
protected function parseLine($line)
{
// Start of a new component
if (strtoupper(substr($line, 0, 6)) === 'BEGIN:') {
$component = $this->root->createComponent(substr($line, 6), [], false);
while (true) {
// Reading until we hit END:
$line = $this->readLine();
if (strtoupper(substr($line, 0, 4)) === 'END:') {
break;
}
$result = $this->parseLine($line);
if ($result) {
$component->add($result);
}
}
$name = strtoupper(substr($line, 4));
if ($name !== $component->name) {
throw new ParseException('Invalid MimeDir file. expected: "END:' . $component->name . '" got: "END:' . $name . '"');
}
return $component;
} else {
// Property reader
$property = $this->readProperty($line);
if (!$property) {
// Ignored line
return false;
}
return $property;
}
}