[Pkg-owncloud-commits] [php-sabre-vobject] 138/341: Fix <request-status /> when unserializing to xCal.

David Prévot taffit at moszumanska.debian.org
Tue Aug 11 13:35:41 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 f80483ee8459d0c71fe927b2d2ca3a51951b7ca7
Author: Ivan Enderlin <ivan.enderlin at hoa-project.net>
Date:   Fri Jan 16 10:12:00 2015 +0100

    Fix <request-status /> when unserializing to xCal.
---
 lib/Property/Text.php | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 67 insertions(+)

diff --git a/lib/Property/Text.php b/lib/Property/Text.php
index 666ef60..cedbd3c 100644
--- a/lib/Property/Text.php
+++ b/lib/Property/Text.php
@@ -283,9 +283,76 @@ class Text extends Property {
 
             return $out;
 
+        }
+
+    }
+
+    /**
+     * Returns the value, in the format it should be encoded for XML.
+     *
+     * This method must always return an array.
+     *
+     * @return array
+     */
+    public function getXmlValue() {
+
+        $val = $this->getParts();
+
+        // Special-casing the REQUEST-STATUS property.
+        //
+        // See:
+        // http://tools.ietf.org/html/rfc6321#section-3.4.1.3
+        if ($this->name === 'REQUEST-STATUS') {
+
+            $handle = [
+                [
+                    'name' => 'code',
+                    'value' => $val[0]
+                ],
+                [
+                    'name' => 'description',
+                    'value' => $val[1]
+                ]
+            ];
+
+            if(isset($val[2]))
+                $handle[] = [
+                    'name' => 'data',
+                    'value' => $val[2]
+                ];
+
+            return [$handle];
 
         }
 
+        return $val;
+
+    }
+
+    /**
+     * 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() {
+
+        $serialization = parent::xmlSerialize();
+
+        // Special-casing the REQUEST-STATUS property.
+        //
+        // See:
+        // http://tools.ietf.org/html/rfc6321#section-3.4.1.3
+        if ($this->name === 'REQUEST-STATUS') {
+
+            $handle = $serialization['value'][0]['value'];
+            $serialization['value'] = $handle;
+            return $serialization;
+
+        }
+
+        return $serialization;
+
     }
 
     /**

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