ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
SupportedAddressData.php
Go to the documentation of this file.
1<?php
2
4
8
24
30 protected $supportedData = [];
31
37 function __construct(array $supportedData = null) {
38
39 if (is_null($supportedData)) {
41 ['contentType' => 'text/vcard', 'version' => '3.0'],
42 ['contentType' => 'text/vcard', 'version' => '4.0'],
43 ['contentType' => 'application/vcard+json', 'version' => '4.0'],
44 ];
45 }
46
47 $this->supportedData = $supportedData;
48
49 }
50
70 function xmlSerialize(Writer $writer) {
71
72 foreach ($this->supportedData as $supported) {
73 $writer->startElement('{' . Plugin::NS_CARDDAV . '}address-data-type');
74 $writer->writeAttributes([
75 'content-type' => $supported['contentType'],
76 'version' => $supported['version']
77 ]);
78 $writer->endElement(); // address-data-type
79 }
80
81 }
82
83}
An exception for terminatinating execution or to throw for unit testing.
CardDAV plugin.
Definition: Plugin.php:23
const NS_CARDDAV
xml namespace for CardDAV elements
Definition: Plugin.php:33
xmlSerialize(Writer $writer)
The xmlSerialize method is called during xml writing.
__construct(array $supportedData=null)
Creates the property.
The XML Writer class.
Definition: Writer.php:31
startElement($name)
Opens a new element.
Definition: Writer.php:121
writeAttributes(array $attributes)
Writes a list of attributes.
Definition: Writer.php:211
Objects implementing XmlSerializable can control how they are represented in Xml.