本文整理汇总了PHP中Sabre\VObject\Component\VCalendar::getComponents方法的典型用法代码示例。如果您正苦于以下问题:PHP VCalendar::getComponents方法的具体用法?PHP VCalendar::getComponents怎么用?PHP VCalendar::getComponents使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sabre\VObject\Component\VCalendar
的用法示例。
在下文中一共展示了VCalendar::getComponents方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processMessageRequest
/**
* Processes incoming REQUEST messages.
*
* This is message from an organizer, and is either a new event
* invite, or an update to an existing one.
*
*
* @param Message $itipMessage
* @param VCalendar $existingObject
* @return VCalendar|null
*/
protected function processMessageRequest(Message $itipMessage, VCalendar $existingObject = null)
{
if (!$existingObject) {
// This is a new invite, and we're just going to copy over
// all the components from the invite.
$existingObject = new VCalendar();
foreach ($itipMessage->message->getComponents() as $component) {
$existingObject->add(clone $component);
}
} else {
// We need to update an existing object with all the new
// information. We can just remove all existing components
// and create new ones.
foreach ($existingObject->getComponents() as $component) {
$existingObject->remove($component);
}
foreach ($itipMessage->message->getComponents() as $component) {
$existingObject->add(clone $component);
}
}
return $existingObject;
}
示例2: testGetComponents
function testGetComponents()
{
$comp = new VCalendar();
$comp->add($comp->createProperty('FOO', 'BAR'));
$comp->add($comp->createComponent('VTODO'));
$r = $comp->getComponents();
$this->assertInternalType('array', $r);
$this->assertEquals(1, count($r));
$this->assertEquals('VTODO', $r[0]->name);
}