[Pkg-owncloud-commits] [php-sabre-vobject] 81/341: !xml Add the VObject\Writer helpers.
David Prévot
taffit at moszumanska.debian.org
Tue Aug 11 13:35:36 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository php-sabre-vobject.
commit a2ac0879fb8a11d5bfa2fd82945baa1ed73b2ae1
Author: Ivan Enderlin <ivan.enderlin at hoa-project.net>
Date: Mon Nov 24 14:13:16 2014 +0100
!xml Add the VObject\Writer helpers.
---
lib/Writer.php | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 61 insertions(+)
diff --git a/lib/Writer.php b/lib/Writer.php
new file mode 100644
index 0000000..1adb07c
--- /dev/null
+++ b/lib/Writer.php
@@ -0,0 +1,61 @@
+<?php
+
+namespace Sabre\VObject;
+
+use Sabre\XML;
+
+/**
+ * iCalendar/vCard/jCal/jCard/xCal/xCard writer object.
+ *
+ * This object provides a few (static) convenience methods to quickly access
+ * the serializers.
+ *
+ * @copyright Copyright (C) 2007-2014 fruux GmbH (https://fruux.com/).
+ * @author Evert Pot (http://evertpot.com/)
+ * @license http://sabre.io/license/ Modified BSD License
+ */
+class Writer {
+
+ /**
+ * Serializes a vCard or iCalendar object.
+ *
+ * @param Component $component
+ * @return string
+ */
+ static function write(Component $component) {
+
+ return $component->serialize();
+
+ }
+
+ /**
+ * Serializes a jCal or jCard object.
+ *
+ * @param Component $component
+ * @param int $options
+ * @return string
+ */
+ static function writeJson(Component $component, $options = 0) {
+
+ return json_encode($component, $options);
+
+ }
+
+ /**
+ * Serializes a xCal or xCard object.
+ *
+ * @param Component $component
+ * @return string
+ */
+ static public function writeXML(Component $component) {
+
+ $writer = new XML\Writer();
+ $writer->openMemory();
+ $writer->setIndent(true);
+ $writer->write($component->xmlSerialize());
+
+ return $writer->outputMemory();
+
+ }
+
+}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/php-sabre-vobject.git
More information about the Pkg-owncloud-commits
mailing list