1<?php 2 3namespace Sabre\CalDAV\Xml\Property; 4 5use Sabre\Xml\XmlSerializable; 6use Sabre\Xml\Writer; 7use Sabre\CalDAV\Plugin; 8 9/** 10 * Supported-calendar-data property 11 * 12 * This property is a representation of the supported-calendar-data property 13 * in the CalDAV namespace. SabreDAV only has support for text/calendar;2.0 14 * so the value is currently hardcoded. 15 * 16 * This property is defined in: 17 * http://tools.ietf.org/html/rfc4791#section-5.2.4 18 * 19 * @copyright Copyright (C) 2007-2015 fruux GmbH (https://fruux.com/). 20 * @author Evert Pot (http://www.rooftopsolutions.nl/) 21 * @license http://sabre.io/license/ Modified BSD License 22 */ 23class SupportedCalendarData implements XmlSerializable { 24 25 /** 26 * The xmlSerialize metod is called during xml writing. 27 * 28 * Use the $writer argument to write its own xml serialization. 29 * 30 * An important note: do _not_ create a parent element. Any element 31 * implementing XmlSerializble should only ever write what's considered 32 * its 'inner xml'. 33 * 34 * The parent of the current element is responsible for writing a 35 * containing element. 36 * 37 * This allows serializers to be re-used for different element names. 38 * 39 * If you are opening new elements, you must also close them again. 40 * 41 * @param Writer $writer 42 * @return void 43 */ 44 function xmlSerialize(Writer $writer) { 45 46 $writer->startElement('{' . Plugin::NS_CALDAV . '}calendar-data'); 47 $writer->writeAttributes([ 48 'content-type' => 'text/calendar', 49 'version' => '2.0', 50 ]); 51 $writer->endElement(); // calendar-data 52 $writer->startElement('{' . Plugin::NS_CALDAV . '}calendar-data'); 53 $writer->writeAttributes([ 54 'content-type' => 'application/calendar+json', 55 ]); 56 $writer->endElement(); // calendar-data 57 58 } 59 60} 61