[Pkg-owncloud-commits] [php-sabre-vobject] 78/341: !xml Implement the Component::xmlSerialize() method.

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 f8ad897f1ed9a2addeff1cd70c0e3d864d265337
Author: Ivan Enderlin <ivan.enderlin at hoa-project.net>
Date:   Mon Nov 24 11:36:18 2014 +0100

    !xml Implement the Component::xmlSerialize() method.
---
 lib/Component.php | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/lib/Component.php b/lib/Component.php
index d51a406..a08b444 100644
--- a/lib/Component.php
+++ b/lib/Component.php
@@ -346,6 +346,33 @@ class Component extends Node {
     }
 
     /**
+     * This method returns an array, with the representation as it should be
+     * encoded in XML. This is used to create xCard or xCal documents.
+     *
+     * @return array
+     */
+    function xmlSerialize() {
+
+        $components = [];
+        $properties = [];
+
+        foreach($this->children as $child) {
+            if ($child instanceof Component) {
+                $components[] = $child->xmlSerialize();
+            } else {
+                $properties[] = $child->xmlSerialize();
+            }
+        }
+
+        return [
+            strtolower($this->name),
+            $properties,
+            $components
+        ];
+
+    }
+
+    /**
      * This method should return a list of default property values.
      *
      * @return array

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