[Pkg-owncloud-commits] [php-sabre-vobject] 204/341: Serialize N to xCard properly.

David Prévot taffit at moszumanska.debian.org
Tue Aug 11 13:35:48 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 3540fd0860eac44c1deb70acac2d6f65965b5542
Author: Ivan Enderlin <ivan.enderlin at hoa-project.net>
Date:   Mon Jan 26 15:23:36 2015 +0100

    Serialize N to xCard properly.
---
 lib/Property/Text.php | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/lib/Property/Text.php b/lib/Property/Text.php
index 22e57fd..962a9cf 100644
--- a/lib/Property/Text.php
+++ b/lib/Property/Text.php
@@ -311,6 +311,21 @@ class Text extends Property {
                 $writer->writeElement('data', $value[2]);
             }
 
+        } elseif ($this->name === 'N') {
+
+            $values = $this->getParts();
+            $mapping = [
+                'surname'    => !empty($values[0]) ? $values[0] : null,
+                'given'      => !empty($values[1]) ? $values[1] : null,
+                'additional' => !empty($values[2]) ? $values[2] : null,
+                'prefix'     => !empty($values[3]) ? $values[3] : null,
+                'suffix'     => !empty($values[4]) ? $values[4] : null,
+            ];
+
+            foreach ($mapping as $name => $value) {
+                $writer->writeElement($name, $value);
+            }
+
         } else {
             parent::xmlSerializeValue($writer);
         }

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