當前位置: 首頁>>代碼示例>>PHP>>正文


PHP VCalendar::getComponents方法代碼示例

本文整理匯總了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;
 }
開發者ID:sksree,項目名稱:Jorani_new,代碼行數:33,代碼來源:Broker.php

示例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);
 }
開發者ID:bodun,項目名稱:jorani,代碼行數:10,代碼來源:ComponentTest.php


注:本文中的Sabre\VObject\Component\VCalendar::getComponents方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。