xref: /plugin/davcal/vendor/sabre/xml/lib/XmlSerializable.php (revision a1a3b6794e0e143a4a8b51d3185ce2d339be61ab)
1*a1a3b679SAndreas Boehler<?php
2*a1a3b679SAndreas Boehler
3*a1a3b679SAndreas Boehlernamespace Sabre\Xml;
4*a1a3b679SAndreas Boehler
5*a1a3b679SAndreas Boehler/**
6*a1a3b679SAndreas Boehler * Objects implementing XmlSerializable can control how they are represented in
7*a1a3b679SAndreas Boehler * Xml.
8*a1a3b679SAndreas Boehler *
9*a1a3b679SAndreas Boehler * @copyright Copyright (C) 2009-2015 fruux GmbH (https://fruux.com/).
10*a1a3b679SAndreas Boehler * @author Evert Pot (http://evertpot.com/)
11*a1a3b679SAndreas Boehler * @license http://sabre.io/license/ Modified BSD License
12*a1a3b679SAndreas Boehler */
13*a1a3b679SAndreas Boehlerinterface XmlSerializable {
14*a1a3b679SAndreas Boehler
15*a1a3b679SAndreas Boehler    /**
16*a1a3b679SAndreas Boehler     * The xmlSerialize metod is called during xml writing.
17*a1a3b679SAndreas Boehler     *
18*a1a3b679SAndreas Boehler     * Use the $writer argument to write its own xml serialization.
19*a1a3b679SAndreas Boehler     *
20*a1a3b679SAndreas Boehler     * An important note: do _not_ create a parent element. Any element
21*a1a3b679SAndreas Boehler     * implementing XmlSerializble should only ever write what's considered
22*a1a3b679SAndreas Boehler     * its 'inner xml'.
23*a1a3b679SAndreas Boehler     *
24*a1a3b679SAndreas Boehler     * The parent of the current element is responsible for writing a
25*a1a3b679SAndreas Boehler     * containing element.
26*a1a3b679SAndreas Boehler     *
27*a1a3b679SAndreas Boehler     * This allows serializers to be re-used for different element names.
28*a1a3b679SAndreas Boehler     *
29*a1a3b679SAndreas Boehler     * If you are opening new elements, you must also close them again.
30*a1a3b679SAndreas Boehler     *
31*a1a3b679SAndreas Boehler     * @param Writer $writer
32*a1a3b679SAndreas Boehler     * @return void
33*a1a3b679SAndreas Boehler     */
34*a1a3b679SAndreas Boehler    function xmlSerialize(Writer $writer);
35*a1a3b679SAndreas Boehler
36*a1a3b679SAndreas Boehler}
37