ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Sabre\VObject\Writer Class Reference

iCalendar/vCard/jCal/jCard/xCal/xCard writer object. More...

+ Collaboration diagram for Sabre\VObject\Writer:

Static Public Member Functions

static write (Component $component)
 Serializes a vCard or iCalendar object. More...
 
static writeJson (Component $component, $options=0)
 Serializes a jCal or jCard object. More...
 
static writeXml (Component $component)
 Serializes a xCal or xCard object. More...
 

Detailed Description

iCalendar/vCard/jCal/jCard/xCal/xCard writer object.

This object provides a few (static) convenience methods to quickly access the serializers.

Author
Ivan Enderlin http://sabre.io/license/ Modified BSD License

Definition at line 17 of file Writer.php.

Member Function Documentation

◆ write()

static Sabre\VObject\Writer::write ( Component  $component)
static

Serializes a vCard or iCalendar object.

Parameters
Component$component
Returns
string

Definition at line 26 of file Writer.php.

References Sabre\VObject\Component\serialize().

Referenced by Sabre\VObject\Parser\XmlTest\testRFC6321Example2(), and Sabre\VObject\WriterTest\testWriteToMimeDir().

26  {
27 
28  return $component->serialize();
29 
30  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ writeJson()

static Sabre\VObject\Writer::writeJson ( Component  $component,
  $options = 0 
)
static

Serializes a jCal or jCard object.

Parameters
Component$component
int$options
Returns
string

Definition at line 40 of file Writer.php.

References PHPMailer\PHPMailer\$options.

Referenced by Sabre\VObject\WriterTest\testWriteToJson().

40  {
41 
42  return json_encode($component, $options);
43 
44  }
+ Here is the caller graph for this function:

◆ writeXml()

static Sabre\VObject\Writer::writeXml ( Component  $component)
static

Serializes a xCal or xCard object.

Parameters
Component$component
Returns
string

Definition at line 53 of file Writer.php.

References Sabre\VObject\Component\xmlSerialize().

Referenced by Sabre\VObject\WriterTest\testWriteToXml().

53  {
54 
55  $writer = new Xml\Writer();
56  $writer->openMemory();
57  $writer->setIndent(true);
58 
59  $writer->startDocument('1.0', 'utf-8');
60 
61  if ($component instanceof Component\VCalendar) {
62 
63  $writer->startElement('icalendar');
64  $writer->writeAttribute('xmlns', Parser\Xml::XCAL_NAMESPACE);
65 
66  } else {
67 
68  $writer->startElement('vcards');
69  $writer->writeAttribute('xmlns', Parser\Xml::XCARD_NAMESPACE);
70 
71  }
72 
73  $component->xmlSerialize($writer);
74 
75  $writer->endElement();
76 
77  return $writer->outputMemory();
78 
79  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

The documentation for this class was generated from the following file: