本文整理匯總了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);
}