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