public function createExtendedCollection($name, MkCol $mkCol)
    {
        $isCalendar = false;
        $isSubscription = false;
        foreach ($mkCol->getResourceType() as $rt) {
            switch ($rt) {
                case '{DAV:}collection':
                case '{http://calendarserver.org/ns/}shared-owner':
                    // ignore
                    break;
                case '{urn:ietf:params:xml:ns:caldav}calendar':
                    $isCalendar = true;
                    break;
                case '{http://calendarserver.org/ns/}subscribed':
                    $isSubscription = true;
                    break;
                default:
                    throw new DAV\Exception\InvalidResourceType('Unknown resourceType: '.$rt);
            }
        }

        $properties = $mkCol->getRemainingValues();
        $mkCol->setRemainingResultCode(201);

        if ($isSubscription) {
            if (!$this->caldavBackend instanceof Backend\SubscriptionSupport) {
                throw new DAV\Exception\InvalidResourceType('This backend does not support subscriptions');
            }
            $this->caldavBackend->createSubscription($this->principalInfo['uri'], $name, $properties);
        } elseif ($isCalendar) {
            $this->caldavBackend->createCalendar($this->principalInfo['uri'], $name, $properties);
        } else {
            throw new DAV\Exception\InvalidResourceType('You can only create calendars and subscriptions in this collection');
        }
    }
public function createExtendedCollection($name, MkCol $mkCol)
    {
        $isCalendar = false;
        $isSubscription = false;
        foreach ($mkCol->getResourceType() as $rt) {
            switch ($rt) {
                case '{DAV:}collection':
                case '{http://calendarserver.org/ns/}shared-owner':
                    // ignore
                    break;
                case '{urn:ietf:params:xml:ns:caldav}calendar':
                    $isCalendar = true;
                    break;
                case '{http://calendarserver.org/ns/}subscribed':
                    $isSubscription = true;
                    break;
                default:
                    throw new DAV\Exception\InvalidResourceType('Unknown resourceType: '.$rt);
            }
        }

        $properties = $mkCol->getRemainingValues();
        $mkCol->setRemainingResultCode(201);

        if ($isSubscription) {
            if (!$this->caldavBackend instanceof Backend\SubscriptionSupport) {
                throw new DAV\Exception\InvalidResourceType('This backend does not support subscriptions');
            }
            $this->caldavBackend->createSubscription($this->principalInfo['uri'], $name, $properties);
        } elseif ($isCalendar) {
            $this->caldavBackend->createCalendar($this->principalInfo['uri'], $name, $properties);
        } else {
            throw new DAV\Exception\InvalidResourceType('You can only create calendars and subscriptions in this collection');
        }
    }
public function createExtendedCollection ( $ name , MkCol $ mkCol ) { $ isCalendar = false ; $ isSubscription = false ; foreach ( $ mkCol -> getResourceType ( ) as $ rt ) { switch ( $ rt ) { case '{DAV:}collection' : case '{http://calendarserver.org/ns/}shared-owner' : // ignore break ; case '{urn:ietf:params:xml:ns:caldav}calendar' : $ isCalendar = true ; break ; case '{http://calendarserver.org/ns/}subscribed' : $ isSubscription = true ; break ; default : throw new DAV \ Exception \ InvalidResourceType ( 'Unknown resourceType: ' . $ rt ) ; } } $ properties = $ mkCol -> getRemainingValues ( ) ; $ mkCol -> setRemainingResultCode ( 201 ) ; if ( $ isSubscription ) { if ( ! $ this -> caldavBackend instanceof Backend \ SubscriptionSupport ) { throw new DAV \ Exception \ InvalidResourceType ( 'This backend does not support subscriptions' ) ; } $ this -> caldavBackend -> createSubscription ( $ this -> principalInfo [ 'uri' ] , $ name , $ properties ) ; } elseif ( $ isCalendar ) { $ this -> caldavBackend -> createCalendar ( $ this -> principalInfo [ 'uri' ] , $ name , $ properties ) ; } else { throw new DAV \ Exception \ InvalidResourceType ( 'You can only create calendars and subscriptions in this collection' ) ; } }
Creates a new calendar or subscription.

@param string $name
@param MkCol  $mkCol

@throws DAV\Exception\InvalidResourceType
Creates a new calendar or subscription .