[Pkg-owncloud-commits] [php-sabre-vobject] 79/341: !xml Export components & properties to XML\Writer format.
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 351e7f9e1182b252d7accf5555ad51737cef3367
Author: Ivan Enderlin <ivan.enderlin at hoa-project.net>
Date: Mon Nov 24 14:04:10 2014 +0100
!xml Export components & properties to XML\Writer format.
---
lib/Component.php | 23 ++++++++++++++++++-----
lib/Property.php | 21 ++++++++++++++++++++-
2 files changed, 38 insertions(+), 6 deletions(-)
diff --git a/lib/Component.php b/lib/Component.php
index a08b444..12854a0 100644
--- a/lib/Component.php
+++ b/lib/Component.php
@@ -358,18 +358,31 @@ class Component extends Node {
foreach($this->children as $child) {
if ($child instanceof Component) {
- $components[] = $child->xmlSerialize();
+ $components[] = $child->xmlSerialize()[0];
} else {
$properties[] = $child->xmlSerialize();
}
}
- return [
- strtolower($this->name),
- $properties,
- $components
+ $out = [
+ 'name' => strtolower($this->name),
+ 'value' => []
];
+ if(!empty($properties))
+ $out['value'][] = [
+ 'name' => 'properties',
+ 'value' => $properties
+ ];
+
+ if(!empty($components))
+ $out['value'][] = [
+ 'name' => 'components',
+ 'value' => $components
+ ];
+
+ return [$out];
+
}
/**
diff --git a/lib/Property.php b/lib/Property.php
index 5626caf..6aad0cd 100644
--- a/lib/Property.php
+++ b/lib/Property.php
@@ -354,7 +354,26 @@ abstract class Property extends Node {
*/
function xmlSerialize() {
- return $this->jsonSerialize();
+ $parameters = [];
+
+ foreach($this->parameters as $parameter) {
+ if ($parameter->name === 'VALUE') {
+ continue;
+ }
+ $parameters[strtolower($parameter->name)] = $parameter->xmlSerialize();
+ }
+
+ return [
+ 'name' => strtolower($this->name),
+ //(object)$parameters,
+ 'value' => [
+ [
+ 'name' => strtolower($this->getValueType()),
+ 'value' => $this->getXmlValue()[0]
+ ]
+ ]
+ ];
+
}
/**
--
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