[Pkg-owncloud-commits] [php-sabre-vobject] 227/341: Support multi-valued property serialization to XML.

David Prévot taffit at moszumanska.debian.org
Tue Aug 11 13:35:51 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 0b2ab1dbfa62149bc541bd86f37034f07f86c49a
Author: Ivan Enderlin <ivan.enderlin at hoa-project.net>
Date:   Tue Jan 27 14:25:32 2015 +0100

    Support multi-valued property serialization to XML.
    
    It introduces a “regression” with `RECUR`, so we write a specific
    `xmlSerializeValue` method for the `Property\ICalendar\Recur` class
    (like we already do for other properties).
---
 lib/Property.php                 |  8 ++++++--
 lib/Property/ICalendar/Recur.php | 21 ++++++++++++++++++++-
 2 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/lib/Property.php b/lib/Property.php
index 261b62e..2f1ac0c 100644
--- a/lib/Property.php
+++ b/lib/Property.php
@@ -387,8 +387,12 @@ abstract class Property extends Node {
      */
     protected function xmlSerializeValue(Xml\Writer $writer) {
 
-        foreach ($this->getJsonValue() as $value) {
-            $writer->writeElement(strtolower($this->getValueType()), $value);
+        $valueType = strtolower($this->getValueType());
+
+        foreach ($this->getJsonValue() as $values) {
+            foreach((array)$values as $value) {
+                $writer->writeElement($valueType, $value);
+            }
         }
 
     }
diff --git a/lib/Property/ICalendar/Recur.php b/lib/Property/ICalendar/Recur.php
index 4504f07..e75b0c0 100644
--- a/lib/Property/ICalendar/Recur.php
+++ b/lib/Property/ICalendar/Recur.php
@@ -2,7 +2,9 @@
 
 namespace Sabre\VObject\Property\ICalendar;
 
-use Sabre\VObject\Property;
+use
+    Sabre\VObject\Property,
+    Sabre\Xml;
 
 /**
  * Recur property
@@ -169,6 +171,23 @@ class Recur extends Property {
     }
 
     /**
+     * This method serializes only the value of a property. This is used to
+     * create xCard or xCal documents.
+     *
+     * @param Xml\Writer $writer  XML writer.
+     * @return void
+     */
+    protected function xmlSerializeValue(Xml\Writer $writer) {
+
+        $valueType = strtolower($this->getValueType());
+
+        foreach ($this->getJsonValue() as $value) {
+            $writer->writeElement($valueType, $value);
+        }
+
+    }
+
+    /**
      * Parses an RRULE value string, and turns it into a struct-ish array.
      *
      * @param string $value

-- 
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