[Pkg-owncloud-commits] [php-sabredav] 40/148: Lots of cleanups.

David Prévot taffit at moszumanska.debian.org
Wed Apr 15 01:37:10 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository php-sabredav.

commit efc79a3cf62fe65cc45ed27e3b87e53209241413
Author: Evert Pot <me at evertpot.com>
Date:   Wed Feb 11 22:56:50 2015 -0500

    Lots of cleanups.
---
 lib/CalDAV/Plugin.php                              |  6 +-
 lib/CalDAV/Xml/Filter/CalendarData.php             |  1 -
 lib/CalDAV/Xml/Filter/CompFilter.php               |  2 -
 lib/CalDAV/Xml/Filter/ParamFilter.php              | 36 ++---------
 lib/CalDAV/Xml/Filter/PropFilter.php               | 45 +++-----------
 lib/CalDAV/Xml/Notification/Invite.php             | 37 +-----------
 lib/CalDAV/Xml/Notification/InviteReply.php        | 29 ---------
 lib/CalDAV/Xml/Notification/SystemStatus.php       | 26 --------
 lib/CalDAV/Xml/Property/AllowedSharingModes.php    |  8 +--
 lib/CalDAV/Xml/Property/ScheduleCalendarTransp.php | 11 ++--
 lib/CalDAV/Xml/Property/SupportedCollationSet.php  |  1 -
 lib/CalDAV/Xml/Request/InviteReply.php             | 44 +++-----------
 lib/CalDAV/Xml/Request/MkCalendar.php              | 34 ++---------
 lib/CalDAV/Xml/Request/Share.php                   | 40 +++----------
 .../Xml/Request/AddressBookMultiGetReport.php      | 41 +++----------
 lib/CardDAV/Xml/Request/AddressBookQueryReport.php | 42 +++----------
 lib/DAV/Browser/Plugin.php                         |  1 -
 lib/DAV/Xml/Element/Response.php                   | 24 ++++----
 lib/DAV/Xml/Property/LockDiscovery.php             | 37 ++----------
 lib/DAV/Xml/Property/ResourceType.php              |  7 +--
 lib/DAV/Xml/Property/SupportedLock.php             | 59 ++++++------------
 lib/DAV/Xml/Property/SupportedMethodSet.php        | 56 +++++------------
 lib/DAV/Xml/Property/SupportedReportSet.php        | 70 +++++++---------------
 lib/DAV/Xml/Request/MkCol.php                      | 34 ++---------
 lib/DAV/Xml/Request/PropFind.php                   | 39 +++---------
 lib/DAV/Xml/Request/SyncCollectionReport.php       | 40 +++----------
 lib/DAV/Xml/Response/MultiStatus.php               | 12 ++--
 lib/DAVACL/Xml/Property/AclRestrictions.php        |  6 +-
 .../Xml/Property/CurrentUserPrivilegeSet.php       | 12 ++--
 lib/DAVACL/Xml/Property/Principal.php              | 10 ++--
 lib/DAVACL/Xml/Property/SupportedPrivilegeSet.php  |  7 +--
 31 files changed, 176 insertions(+), 641 deletions(-)

diff --git a/lib/CalDAV/Plugin.php b/lib/CalDAV/Plugin.php
index 0bea2bd..309ee00 100644
--- a/lib/CalDAV/Plugin.php
+++ b/lib/CalDAV/Plugin.php
@@ -302,10 +302,10 @@ class Plugin extends DAV\ServerPlugin {
 
             $propFind->handle($ns . 'max-resource-size', $this->maxResourceSize);
             $propFind->handle($ns . 'supported-calendar-data', function() {
-                return new Property\SupportedCalendarData();
+                return new Xml\Property\SupportedCalendarData();
             });
             $propFind->handle($ns . 'supported-collation-set', function() {
-                return new Property\SupportedCollationSet();
+                return new Xml\Property\SupportedCollationSet();
             });
 
         }
@@ -337,7 +337,7 @@ class Plugin extends DAV\ServerPlugin {
                         $emails[] = substr($address,7);
                     }
                 }
-                return new Property\EmailAddressSet($emails);
+                return new Xml\Property\EmailAddressSet($emails);
             });
 
             // These two properties are shortcuts for ical to easily find
diff --git a/lib/CalDAV/Xml/Filter/CalendarData.php b/lib/CalDAV/Xml/Filter/CalendarData.php
index 91cceae..5ab8e85 100644
--- a/lib/CalDAV/Xml/Filter/CalendarData.php
+++ b/lib/CalDAV/Xml/Filter/CalendarData.php
@@ -2,7 +2,6 @@
 
 namespace Sabre\CalDAV\Xml\Filter;
 
-use Sabre\Xml\Element\KeyValue;
 use Sabre\Xml\Reader;
 use Sabre\Xml\XmlDeserializable;
 use Sabre\DAV\Exception\BadRequest;
diff --git a/lib/CalDAV/Xml/Filter/CompFilter.php b/lib/CalDAV/Xml/Filter/CompFilter.php
index 19250a2..221595d 100644
--- a/lib/CalDAV/Xml/Filter/CompFilter.php
+++ b/lib/CalDAV/Xml/Filter/CompFilter.php
@@ -87,8 +87,6 @@ class CompFilter implements XmlDeserializable {
                         throw new BadRequest('The end-date must be larger than the start-date');
                     }
                     break;
-                default :
-                    die('Unknown!' . $elem['name']);
 
             }
 
diff --git a/lib/CalDAV/Xml/Filter/ParamFilter.php b/lib/CalDAV/Xml/Filter/ParamFilter.php
index 8506dbe..79dbfa0 100644
--- a/lib/CalDAV/Xml/Filter/ParamFilter.php
+++ b/lib/CalDAV/Xml/Filter/ParamFilter.php
@@ -2,14 +2,9 @@
 
 namespace Sabre\CalDAV\Xml\Filter;
 
-use
-    Sabre\Xml\Element,
-    Sabre\Xml\Reader,
-    Sabre\Xml\Writer,
-    Sabre\DAV\Exception\CannotSerialize,
-    Sabre\DAV\Exception\BadRequest,
-    Sabre\CalDAV\Plugin,
-    Sabre\VObject\DateTimeParser;
+use Sabre\Xml\Reader;
+use Sabre\Xml\XmlDeserializable;
+use Sabre\CalDAV\Plugin;
 
 
 /**
@@ -26,28 +21,7 @@ use
  * @author Evert Pot (http://www.rooftopsolutions.nl/)
  * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
  */
-class ParamFilter implements Element {
-
-    /**
-     * The serialize method is called during xml writing.
-     *
-     * It should use the $writer argument to encode this object into XML.
-     *
-     * Important note: it is not needed to create the parent element. The
-     * parent element is already created, and we only have to worry about
-     * attributes, child elements and text (if any).
-     *
-     * Important note 2: If you are writing any new elements, you are also
-     * responsible for closing them.
-     *
-     * @param Writer $writer
-     * @return void
-     */
-    public function serializeXml(Writer $writer) {
-
-        throw new CannotSerialize('This element cannot be serialized.');
-
-    }
+class ParamFilter implements XmlDeserializable {
 
     /**
      * The deserialize method is called during xml parsing.
@@ -70,7 +44,7 @@ class ParamFilter implements Element {
      * @param Reader $reader
      * @return mixed
      */
-    static public function deserializeXml(Reader $reader) {
+    static function deserializeXml(Reader $reader) {
 
         $result = [
             'name' => null,
diff --git a/lib/CalDAV/Xml/Filter/PropFilter.php b/lib/CalDAV/Xml/Filter/PropFilter.php
index 5c07e24..411e5c9 100644
--- a/lib/CalDAV/Xml/Filter/PropFilter.php
+++ b/lib/CalDAV/Xml/Filter/PropFilter.php
@@ -2,15 +2,11 @@
 
 namespace Sabre\CalDAV\Xml\Filter;
 
-use
-    Sabre\Xml\Element,
-    Sabre\Xml\Reader,
-    Sabre\Xml\Writer,
-    Sabre\DAV\Exception\CannotSerialize,
-    Sabre\DAV\Exception\BadRequest,
-    Sabre\CalDAV\Plugin,
-    Sabre\VObject\DateTimeParser;
-
+use Sabre\Xml\Reader;
+use Sabre\Xml\XmlDeserializable;
+use Sabre\DAV\Exception\BadRequest;
+use Sabre\CalDAV\Plugin;
+use Sabre\VObject\DateTimeParser;
 
 /**
  * PropFilter parser.
@@ -26,28 +22,7 @@ use
  * @author Evert Pot (http://www.rooftopsolutions.nl/)
  * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
  */
-class PropFilter implements Element {
-
-    /**
-     * The serialize method is called during xml writing.
-     *
-     * It should use the $writer argument to encode this object into XML.
-     *
-     * Important note: it is not needed to create the parent element. The
-     * parent element is already created, and we only have to worry about
-     * attributes, child elements and text (if any).
-     *
-     * Important note 2: If you are writing any new elements, you are also
-     * responsible for closing them.
-     *
-     * @param Writer $writer
-     * @return void
-     */
-    public function serializeXml(Writer $writer) {
-
-        throw new CannotSerialize('This element cannot be serialized.');
-
-    }
+class PropFilter implements XmlDeserializable {
 
     /**
      * The deserialize method is called during xml parsing.
@@ -58,8 +33,8 @@ class PropFilter implements Element {
      * Often you want to return an instance of the current class, but you are
      * free to return other data as well.
      *
-     * Important note 2: You are responsible for advancing the reader to the
-     * next element. Not doing anything will result in a never-ending loop.
+     * You are responsible for advancing the reader to the next element. Not
+     * doing anything will result in a never-ending loop.
      *
      * If you just want to skip parsing for this element altogether, you can
      * just call $reader->next();
@@ -70,7 +45,7 @@ class PropFilter implements Element {
      * @param Reader $reader
      * @return mixed
      */
-    static public function deserializeXml(Reader $reader) {
+    static function xmlDeserialize(Reader $reader) {
 
         $result = [
             'name' => null,
@@ -114,8 +89,6 @@ class PropFilter implements Element {
                         'value'            => $elem['value'],
                     ];
                     break;
-                default :
-                    die('Unknown!' . $elem['name']);
 
             }
 
diff --git a/lib/CalDAV/Xml/Notification/Invite.php b/lib/CalDAV/Xml/Notification/Invite.php
index 7f11ff6..74022c1 100644
--- a/lib/CalDAV/Xml/Notification/Invite.php
+++ b/lib/CalDAV/Xml/Notification/Invite.php
@@ -2,13 +2,9 @@
 
 namespace Sabre\CalDAV\Xml\Notification;
 
-use
-    Sabre\Xml\Element,
-    Sabre\Xml\Reader,
-    Sabre\Xml\Writer,
-    Sabre\CalDAV\SharingPlugin as SharingPlugin,
-    Sabre\DAV,
-    Sabre\CalDAV;
+use Sabre\Xml\Writer;
+use Sabre\CalDAV\SharingPlugin as SharingPlugin;
+use Sabre\CalDAV;
 
 /**
  * This class represents the cs:invite-notification notification element.
@@ -304,31 +300,4 @@ class Invite implements NotificationInterface {
 
     }
 
-    /**
-     * The deserialize method is called during xml parsing.
-     *
-     * This method is called statictly, this is because in theory this method
-     * may be used as a type of constructor, or factory method.
-     *
-     * Often you want to return an instance of the current class, but you are
-     * free to return other data as well.
-     *
-     * Important note 2: You are responsible for advancing the reader to the
-     * next element. Not doing anything will result in a never-ending loop.
-     *
-     * If you just want to skip parsing for this element altogether, you can
-     * just call $reader->next();
-     *
-     * $reader->parseInnerTree() will parse the entire sub-tree, and advance to
-     * the next element.
-     *
-     * @param Reader $reader
-     * @return mixed
-     */
-    static function deserializeXml(Reader $reader) {
-
-        throw new CannotDeserialize('This element does not have a deserializer');
-
-    }
-
 }
diff --git a/lib/CalDAV/Xml/Notification/InviteReply.php b/lib/CalDAV/Xml/Notification/InviteReply.php
index b1a0f62..9c95a1d 100644
--- a/lib/CalDAV/Xml/Notification/InviteReply.php
+++ b/lib/CalDAV/Xml/Notification/InviteReply.php
@@ -2,8 +2,6 @@
 
 namespace Sabre\CalDAV\Xml\Notification;
 
-use Sabre\Xml\Element;
-use Sabre\Xml\Reader;
 use Sabre\Xml\Writer;
 use Sabre\DAV;
 use Sabre\CalDAV;
@@ -210,31 +208,4 @@ class InviteReply implements NotificationInterface {
 
     }
 
-    /**
-     * The deserialize method is called during xml parsing.
-     *
-     * This method is called statictly, this is because in theory this method
-     * may be used as a type of constructor, or factory method.
-     *
-     * Often you want to return an instance of the current class, but you are
-     * free to return other data as well.
-     *
-     * Important note 2: You are responsible for advancing the reader to the
-     * next element. Not doing anything will result in a never-ending loop.
-     *
-     * If you just want to skip parsing for this element altogether, you can
-     * just call $reader->next();
-     *
-     * $reader->parseInnerTree() will parse the entire sub-tree, and advance to
-     * the next element.
-     *
-     * @param Reader $reader
-     * @return mixed
-     */
-    static function deserializeXml(Reader $reader) {
-
-        throw new CannotDeserialize('This element does not have a deserializer');
-
-    }
-
 }
diff --git a/lib/CalDAV/Xml/Notification/SystemStatus.php b/lib/CalDAV/Xml/Notification/SystemStatus.php
index 95009ff..9057f7b 100644
--- a/lib/CalDAV/Xml/Notification/SystemStatus.php
+++ b/lib/CalDAV/Xml/Notification/SystemStatus.php
@@ -181,30 +181,4 @@ class SystemStatus implements NotificationInterface {
 
     }
 
-    /**
-     * The deserialize method is called during xml parsing.
-     *
-     * This method is called statictly, this is because in theory this method
-     * may be used as a type of constructor, or factory method.
-     *
-     * Often you want to return an instance of the current class, but you are
-     * free to return other data as well.
-     *
-     * Important note 2: You are responsible for advancing the reader to the
-     * next element. Not doing anything will result in a never-ending loop.
-     *
-     * If you just want to skip parsing for this element altogether, you can
-     * just call $reader->next();
-     *
-     * $reader->parseInnerTree() will parse the entire sub-tree, and advance to
-     * the next element.
-     *
-     * @param Reader $reader
-     * @return mixed
-     */
-    static function deserializeXml(Reader $reader) {
-
-        throw new CannotDeserialize('This element does not have a deserializer');
-
-    }
 }
diff --git a/lib/CalDAV/Xml/Property/AllowedSharingModes.php b/lib/CalDAV/Xml/Property/AllowedSharingModes.php
index efc41e9..93a44ae 100644
--- a/lib/CalDAV/Xml/Property/AllowedSharingModes.php
+++ b/lib/CalDAV/Xml/Property/AllowedSharingModes.php
@@ -2,11 +2,9 @@
 
 namespace Sabre\CalDAV\Xml\Property;
 
-use
-    Sabre\Xml\XmlSerializable,
-    Sabre\Xml\Reader,
-    Sabre\Xml\Writer,
-    Sabre\CalDAV\Plugin;
+use Sabre\Xml\XmlSerializable;
+use Sabre\Xml\Writer;
+use Sabre\CalDAV\Plugin;
 
 /**
  * AllowedSharingModes
diff --git a/lib/CalDAV/Xml/Property/ScheduleCalendarTransp.php b/lib/CalDAV/Xml/Property/ScheduleCalendarTransp.php
index 6ec9d8f..3a1ec82 100644
--- a/lib/CalDAV/Xml/Property/ScheduleCalendarTransp.php
+++ b/lib/CalDAV/Xml/Property/ScheduleCalendarTransp.php
@@ -2,12 +2,11 @@
 
 namespace Sabre\CalDAV\Xml\Property;
 
-use
-    Sabre\Xml\Element,
-    Sabre\Xml\Reader,
-    Sabre\Xml\Writer,
-    Sabre\Xml\Element\Elements,
-    Sabre\CalDAV\Plugin;
+use Sabre\Xml\Element;
+use Sabre\Xml\Reader;
+use Sabre\Xml\Writer;
+use Sabre\Xml\Element\Elements;
+use Sabre\CalDAV\Plugin;
 
 /**
  * schedule-calendar-transp property.
diff --git a/lib/CalDAV/Xml/Property/SupportedCollationSet.php b/lib/CalDAV/Xml/Property/SupportedCollationSet.php
index 990784f..a683f76 100644
--- a/lib/CalDAV/Xml/Property/SupportedCollationSet.php
+++ b/lib/CalDAV/Xml/Property/SupportedCollationSet.php
@@ -2,7 +2,6 @@
 
 namespace Sabre\CalDAV\Xml\Property;
 
-use Sabre\Xml\Reader;
 use Sabre\Xml\Writer;
 use Sabre\Xml\XmlSerializable;
 use Sabre\CalDAV\Plugin;
diff --git a/lib/CalDAV/Xml/Request/InviteReply.php b/lib/CalDAV/Xml/Request/InviteReply.php
index d63731d..6f5129b 100644
--- a/lib/CalDAV/Xml/Request/InviteReply.php
+++ b/lib/CalDAV/Xml/Request/InviteReply.php
@@ -2,15 +2,12 @@
 
 namespace Sabre\CalDAV\Xml\Request;
 
-use
-    Sabre\Xml\Element,
-    Sabre\Xml\Reader,
-    Sabre\Xml\Writer,
-    Sabre\Xml\Element\KeyValue,
-    Sabre\DAV\Exception\CannotSerialize,
-    Sabre\DAV\Exception\BadRequest,
-    Sabre\CalDAV\Plugin,
-    Sabre\CalDAV\SharingPlugin;
+use Sabre\Xml\Writer;
+use Sabre\Xml\XmlDeserializable;
+use Sabre\Xml\Element\KeyValue;
+use Sabre\DAV\Exception\BadRequest;
+use Sabre\CalDAV\Plugin;
+use Sabre\CalDAV\SharingPlugin;
 
 /**
  * Invite-reply POST request parser
@@ -82,27 +79,6 @@ class InviteReply implements Element {
     }
 
     /**
-     * The serialize method is called during xml writing.
-     *
-     * It should use the $writer argument to encode this object into XML.
-     *
-     * Important note: it is not needed to create the parent element. The
-     * parent element is already created, and we only have to worry about
-     * attributes, child elements and text (if any).
-     *
-     * Important note 2: If you are writing any new elements, you are also
-     * responsible for closing them.
-     *
-     * @param Writer $writer
-     * @return void
-     */
-    public function serializeXml(Writer $writer) {
-
-        throw new CannotSerialize('This element cannot be serialized.');
-
-    }
-
-    /**
      * The deserialize method is called during xml parsing.
      *
      * This method is called statictly, this is because in theory this method
@@ -111,8 +87,8 @@ class InviteReply implements Element {
      * Often you want to return an instance of the current class, but you are
      * free to return other data as well.
      *
-     * Important note 2: You are responsible for advancing the reader to the
-     * next element. Not doing anything will result in a never-ending loop.
+     * You are responsible for advancing the reader to the next element. Not
+     * doing anything will result in a never-ending loop.
      *
      * If you just want to skip parsing for this element altogether, you can
      * just call $reader->next();
@@ -123,7 +99,7 @@ class InviteReply implements Element {
      * @param Reader $reader
      * @return mixed
      */
-    static public function deserializeXml(Reader $reader) {
+    static function xmlDeserialize(Reader $reader) {
 
         $elems = KeyValue::deserializeXml($reader);
 
@@ -159,8 +135,6 @@ class InviteReply implements Element {
                 case '{DAV:}href' :
                     $href = $value;
                     break;
-                default :
-                    die('Death: ' . $name);
             }
 
         }
diff --git a/lib/CalDAV/Xml/Request/MkCalendar.php b/lib/CalDAV/Xml/Request/MkCalendar.php
index aff8053..69dcced 100644
--- a/lib/CalDAV/Xml/Request/MkCalendar.php
+++ b/lib/CalDAV/Xml/Request/MkCalendar.php
@@ -2,11 +2,8 @@
 
 namespace Sabre\CalDAV\Xml\Request;
 
-use
-    Sabre\Xml\Element,
-    Sabre\Xml\Reader,
-    Sabre\Xml\Writer,
-    Sabre\DAV\Exception\CannotSerialize;
+use Sabre\Xml\Reader;
+use Sabre\Xml\XmlDeserializable;
 
 /**
  * MKCALENDAR parser.
@@ -19,7 +16,7 @@ use
  * @author Evert Pot (http://evertpot.com/)
  * @license http://sabre.io/license/ Modified BSD License
  */
-class MkCalendar implements Element {
+class MkCalendar implements XmlDeserializable {
 
     /**
      * The list of properties that will be set.
@@ -40,27 +37,6 @@ class MkCalendar implements Element {
     }
 
     /**
-     * The serialize method is called during xml writing.
-     *
-     * It should use the $writer argument to encode this object into XML.
-     *
-     * Important note: it is not needed to create the parent element. The
-     * parent element is already created, and we only have to worry about
-     * attributes, child elements and text (if any).
-     *
-     * Important note 2: If you are writing any new elements, you are also
-     * responsible for closing them.
-     *
-     * @param Writer $writer
-     * @return void
-     */
-    function xmlSerialize(Writer $writer) {
-
-        throw new CannotSerialize('This element cannot be serialized.');
-
-    }
-
-    /**
      * The deserialize method is called during xml parsing.
      *
      * This method is called statictly, this is because in theory this method
@@ -69,8 +45,8 @@ class MkCalendar implements Element {
      * Often you want to return an instance of the current class, but you are
      * free to return other data as well.
      *
-     * Important note 2: You are responsible for advancing the reader to the
-     * next element. Not doing anything will result in a never-ending loop.
+     * You are responsible for advancing the reader to the next element. Not
+     * doing anything will result in a never-ending loop.
      *
      * If you just want to skip parsing for this element altogether, you can
      * just call $reader->next();
diff --git a/lib/CalDAV/Xml/Request/Share.php b/lib/CalDAV/Xml/Request/Share.php
index 1c327e1..0242a58 100644
--- a/lib/CalDAV/Xml/Request/Share.php
+++ b/lib/CalDAV/Xml/Request/Share.php
@@ -2,12 +2,9 @@
 
 namespace Sabre\CalDAV\Xml\Request;
 
-use
-    Sabre\Xml\Element,
-    Sabre\Xml\Reader,
-    Sabre\Xml\Writer,
-    Sabre\DAV\Exception\CannotSerialize,
-    Sabre\CalDAV\Plugin;
+use Sabre\Xml\Reader;
+use Sabre\Xml\XmlDeserializable;
+use Sabre\CalDAV\Plugin;
 
 /**
  * Share POST request parser
@@ -20,7 +17,7 @@ use
  * @author Evert Pot (http://www.rooftopsolutions.nl/)
  * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
  */
-class Share implements Element {
+class Share implements XmlDeserializable {
 
     /**
      * The list of new people added or updated.
@@ -50,7 +47,7 @@ class Share implements Element {
      * @param array $set
      * @param array $remove
      */
-    public function __construct(array $set, array $remove) {
+    function __construct(array $set, array $remove) {
 
         $this->set = $set;
         $this->remove = $remove;
@@ -58,27 +55,6 @@ class Share implements Element {
     }
 
     /**
-     * The serialize method is called during xml writing.
-     *
-     * It should use the $writer argument to encode this object into XML.
-     *
-     * Important note: it is not needed to create the parent element. The
-     * parent element is already created, and we only have to worry about
-     * attributes, child elements and text (if any).
-     *
-     * Important note 2: If you are writing any new elements, you are also
-     * responsible for closing them.
-     *
-     * @param Writer $writer
-     * @return void
-     */
-    public function serializeXml(Writer $writer) {
-
-        throw new CannotSerialize('This element cannot be serialized.');
-
-    }
-
-    /**
      * The deserialize method is called during xml parsing.
      *
      * This method is called statictly, this is because in theory this method
@@ -87,8 +63,8 @@ class Share implements Element {
      * Often you want to return an instance of the current class, but you are
      * free to return other data as well.
      *
-     * Important note 2: You are responsible for advancing the reader to the
-     * next element. Not doing anything will result in a never-ending loop.
+     * You are responsible for advancing the reader to the next element. Not
+     * doing anything will result in a never-ending loop.
      *
      * If you just want to skip parsing for this element altogether, you can
      * just call $reader->next();
@@ -99,7 +75,7 @@ class Share implements Element {
      * @param Reader $reader
      * @return mixed
      */
-    static public function deserializeXml(Reader $reader) {
+    static function deserializeXml(Reader $reader) {
 
         $elems = $reader->parseInnerTree();
 
diff --git a/lib/CardDAV/Xml/Request/AddressBookMultiGetReport.php b/lib/CardDAV/Xml/Request/AddressBookMultiGetReport.php
index 60c32f5..3e45fad 100644
--- a/lib/CardDAV/Xml/Request/AddressBookMultiGetReport.php
+++ b/lib/CardDAV/Xml/Request/AddressBookMultiGetReport.php
@@ -1,13 +1,9 @@
 <?php
 
-namespace Sabre\CardDAV\XML\Request;
+namespace Sabre\CardDAV\Xml\Request;
 
-use
-    Sabre\XML\Element,
-    Sabre\XML\Reader,
-    Sabre\XML\Writer,
-    Sabre\DAV\Exception\CannotSerialize,
-    Sabre\CardDAV\Plugin;
+use Sabre\Xml\Reader;
+use Sabre\Xml\XmlDeserializable;
 
 /**
  * AddressBookMultiGetReport request parser.
@@ -21,7 +17,7 @@ use
  * @author Evert Pot (http://www.rooftopsolutions.nl/)
  * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
  */
-class AddressBookMultiGetReport implements Element {
+class AddressBookMultiGetReport implements XmlDeserializable {
 
     /**
      * An array with requested properties.
@@ -38,27 +34,6 @@ class AddressBookMultiGetReport implements Element {
     public $hrefs;
 
     /**
-     * The serialize method is called during xml writing.
-     *
-     * It should use the $writer argument to encode this object into XML.
-     *
-     * Important note: it is not needed to create the parent element. The
-     * parent element is already created, and we only have to worry about
-     * attributes, child elements and text (if any).
-     *
-     * Important note 2: If you are writing any new elements, you are also
-     * responsible for closing them.
-     *
-     * @param Writer $writer
-     * @return void
-     */
-    public function serializeXml(Writer $writer) {
-
-        throw new CannotSerialize('This element cannot be serialized.');
-
-    }
-
-    /**
      * The deserialize method is called during xml parsing.
      *
      * This method is called statictly, this is because in theory this method
@@ -67,8 +42,8 @@ class AddressBookMultiGetReport implements Element {
      * Often you want to return an instance of the current class, but you are
      * free to return other data as well.
      *
-     * Important note 2: You are responsible for advancing the reader to the
-     * next element. Not doing anything will result in a never-ending loop.
+     * You are responsible for advancing the reader to the next element. Not
+     * doing anything will result in a never-ending loop.
      *
      * If you just want to skip parsing for this element altogether, you can
      * just call $reader->next();
@@ -79,15 +54,13 @@ class AddressBookMultiGetReport implements Element {
      * @param Reader $reader
      * @return mixed
      */
-    static public function deserializeXml(Reader $reader) {
+    static function deserializeXml(Reader $reader) {
 
         $elems = $reader->parseInnerTree();
         $hrefs = [];
 
         $properties = null;
 
-        $expand = false;
-
         foreach($elems as $elem) {
 
             switch($elem['name']) {
diff --git a/lib/CardDAV/Xml/Request/AddressBookQueryReport.php b/lib/CardDAV/Xml/Request/AddressBookQueryReport.php
index 6badc10..3ff45f8 100644
--- a/lib/CardDAV/Xml/Request/AddressBookQueryReport.php
+++ b/lib/CardDAV/Xml/Request/AddressBookQueryReport.php
@@ -1,14 +1,11 @@
 <?php
 
-namespace Sabre\CardDAV\XML\Request;
+namespace Sabre\CardDAV\Xml\Request;
 
-use
-    Sabre\XML\Element,
-    Sabre\XML\Reader,
-    Sabre\XML\Writer,
-    Sabre\DAV\Exception\CannotSerialize,
-    Sabre\DAV\Exception\BadRequest,
-    Sabre\CardDAV\Plugin;
+use Sabre\Xml\Reader;
+use Sabre\Xml\XmlDeserializable;
+use Sabre\DAV\Exception\BadRequest;
+use Sabre\CardDAV\Plugin;
 
 /**
  * AddressBookQueryReport request parser.
@@ -22,7 +19,7 @@ use
  * @author Evert Pot (http://www.rooftopsolutions.nl/)
  * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
  */
-class AddressBookQueryReport implements Element {
+class AddressBookQueryReport implements XmlDeserializable {
 
     /**
      * An array with requested properties.
@@ -55,27 +52,6 @@ class AddressBookQueryReport implements Element {
     public $test;
 
     /**
-     * The serialize method is called during xml writing.
-     *
-     * It should use the $writer argument to encode this object into XML.
-     *
-     * Important note: it is not needed to create the parent element. The
-     * parent element is already created, and we only have to worry about
-     * attributes, child elements and text (if any).
-     *
-     * Important note 2: If you are writing any new elements, you are also
-     * responsible for closing them.
-     *
-     * @param Writer $writer
-     * @return void
-     */
-    public function serializeXml(Writer $writer) {
-
-        throw new CannotSerialize('This element cannot be serialized.');
-
-    }
-
-    /**
      * The deserialize method is called during xml parsing.
      *
      * This method is called statictly, this is because in theory this method
@@ -84,8 +60,8 @@ class AddressBookQueryReport implements Element {
      * Often you want to return an instance of the current class, but you are
      * free to return other data as well.
      *
-     * Important note 2: You are responsible for advancing the reader to the
-     * next element. Not doing anything will result in a never-ending loop.
+     * You are responsible for advancing the reader to the next element. Not
+     * doing anything will result in a never-ending loop.
      *
      * If you just want to skip parsing for this element altogether, you can
      * just call $reader->next();
@@ -96,7 +72,7 @@ class AddressBookQueryReport implements Element {
      * @param Reader $reader
      * @return mixed
      */
-    static public function deserializeXml(Reader $reader) {
+    static function xmlDeserialize(Reader $reader) {
 
         $elems = $reader->parseInnerTree();
 
diff --git a/lib/DAV/Browser/Plugin.php b/lib/DAV/Browser/Plugin.php
index 1832c4c..a2aba26 100644
--- a/lib/DAV/Browser/Plugin.php
+++ b/lib/DAV/Browser/Plugin.php
@@ -6,7 +6,6 @@ use Sabre\DAV;
 use Sabre\HTTP\URLUtil;
 use Sabre\HTTP\RequestInterface;
 use Sabre\HTTP\ResponseInterface;
-use Sabre\Xml\Writer as XmlWriter;
 
 /**
  * Browser Plugin
diff --git a/lib/DAV/Xml/Element/Response.php b/lib/DAV/Xml/Element/Response.php
index d6fedf6..5a64afe 100644
--- a/lib/DAV/Xml/Element/Response.php
+++ b/lib/DAV/Xml/Element/Response.php
@@ -2,11 +2,9 @@
 
 namespace Sabre\DAV\Xml\Element;
 
-use
-    Sabre\Xml\Element,
-    Sabre\Xml\Reader,
-    Sabre\Xml\Writer,
-    Sabre\DAV\Exception\CannotSerialize;
+use Sabre\Xml\Element;
+use Sabre\Xml\Reader;
+use Sabre\Xml\Writer;
 
 /**
  * WebDAV {DAV:}response parser
@@ -62,7 +60,7 @@ class Response implements Element {
      * @param array $responseProperties
      * @param string $httpStatus
      */
-    public function __construct($href, array $responseProperties, $httpStatus = null) {
+    function __construct($href, array $responseProperties, $httpStatus = null) {
 
         $this->href = $href;
         $this->responseProperties = $responseProperties;
@@ -75,7 +73,7 @@ class Response implements Element {
      *
      * @return string
      */
-    public function getHref() {
+    function getHref() {
 
         return $this->href;
 
@@ -86,7 +84,7 @@ class Response implements Element {
      *
      * @return string
      */
-    public function getHttpStatus() {
+    function getHttpStatus() {
 
         return $this->httpStatus;
 
@@ -97,7 +95,7 @@ class Response implements Element {
      *
      * @return array
      */
-    public function getResponseProperties() {
+    function getResponseProperties() {
 
         return $this->responseProperties;
 
@@ -119,7 +117,7 @@ class Response implements Element {
      * @param Writer $writer
      * @return void
      */
-    public function xmlSerialize(Writer $writer) {
+    function xmlSerialize(Writer $writer) {
 
         if ($status = $this->getHTTPStatus()) {
             $writer->writeElement('{DAV:}status', 'HTTP/1.1 ' . $status . ' ' . \Sabre\HTTP\Response::$statusCodes[$status]);
@@ -149,8 +147,8 @@ class Response implements Element {
      * Often you want to return an instance of the current class, but you are
      * free to return other data as well.
      *
-     * Important note 2: You are responsible for advancing the reader to the
-     * next element. Not doing anything will result in a never-ending loop.
+     * You are responsible for advancing the reader to the next element. Not
+     * doing anything will result in a never-ending loop.
      *
      * If you just want to skip parsing for this element altogether, you can
      * just call $reader->next();
@@ -161,7 +159,7 @@ class Response implements Element {
      * @param Reader $reader
      * @return mixed
      */
-    static public function xmlDeserialize(Reader $reader) {
+    static function xmlDeserialize(Reader $reader) {
 
         $elems = $reader->parseInnerTree();
 
diff --git a/lib/DAV/Xml/Property/LockDiscovery.php b/lib/DAV/Xml/Property/LockDiscovery.php
index 8ec0bf8..139a723 100644
--- a/lib/DAV/Xml/Property/LockDiscovery.php
+++ b/lib/DAV/Xml/Property/LockDiscovery.php
@@ -2,11 +2,10 @@
 
 namespace Sabre\DAV\Xml\Property;
 
-use
-    Sabre\DAV,
-    Sabre\Xml\Element,
-    Sabre\Xml\Reader,
-    Sabre\Xml\Writer;
+use Sabre\DAV;
+use Sabre\Xml\XmlSerializable;
+use Sabre\Xml\Reader;
+use Sabre\Xml\Writer;
 
 /**
  * Represents {DAV:}lockdiscovery property.
@@ -20,7 +19,7 @@ use
  * @author Evert Pot (http://www.rooftopsolutions.nl/)
  * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
  */
-class LockDiscovery implements Element {
+class LockDiscovery implements XmlSerializable {
 
     /**
      * locks
@@ -103,31 +102,5 @@ class LockDiscovery implements Element {
 
     }
 
-    /**
-     * The deserialize method is called during xml parsing.
-     *
-     * This method is called statictly, this is because in theory this method
-     * may be used as a type of constructor, or factory method.
-     *
-     * Often you want to return an instance of the current class, but you are
-     * free to return other data as well.
-     *
-     * Important note 2: You are responsible for advancing the reader to the
-     * next element. Not doing anything will result in a never-ending loop.
-     *
-     * If you just want to skip parsing for this element altogether, you can
-     * just call $reader->next();
-     *
-     * $reader->parseInnerTree() will parse the entire sub-tree, and advance to
-     * the next element.
-     *
-     * @param Reader $reader
-     * @return mixed
-     */
-    static function xmlDeserialize(Reader $reader) {
-
-        throw new CannotDeserialize('This element does not have a deserializer');
-
-    }
 }
 
diff --git a/lib/DAV/Xml/Property/ResourceType.php b/lib/DAV/Xml/Property/ResourceType.php
index 6f63ee2..c116c13 100644
--- a/lib/DAV/Xml/Property/ResourceType.php
+++ b/lib/DAV/Xml/Property/ResourceType.php
@@ -2,11 +2,8 @@
 
 namespace Sabre\DAV\Xml\Property;
 
-use
-    Sabre\Xml\Element,
-    Sabre\Xml\Reader,
-    Sabre\Xml\Writer,
-    Sabre\DAV\Exception\CannotSerialize;
+use Sabre\Xml\Element;
+use Sabre\Xml\Reader;
 
 /**
  * {DAV:}resourcetype property
diff --git a/lib/DAV/Xml/Property/SupportedLock.php b/lib/DAV/Xml/Property/SupportedLock.php
index 6816792..4bd37ba 100644
--- a/lib/DAV/Xml/Property/SupportedLock.php
+++ b/lib/DAV/Xml/Property/SupportedLock.php
@@ -2,11 +2,9 @@
 
 namespace Sabre\DAV\Xml\Property;
 
-use
-    Sabre\DAV,
-    Sabre\Xml\Element,
-    Sabre\Xml\Reader,
-    Sabre\Xml\Writer;
+use Sabre\DAV;
+use Sabre\Xml\Writer;
+use Sabre\Xml\XmlSerializable;
 
 /**
  * This class represents the {DAV:}supportedlock property.
@@ -21,7 +19,7 @@ use
  * @author Evert Pot (http://www.rooftopsolutions.nl/)
  * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
  */
-class SupportedLock implements Element {
+class SupportedLock implements XmlSerializable {
 
     /**
      * supportsLocks
@@ -35,28 +33,32 @@ class SupportedLock implements Element {
      *
      * @param bool $supportsLocks
      */
-    public function __construct($supportsLocks) {
+    function __construct($supportsLocks) {
 
         $this->supportsLocks = $supportsLocks;
 
     }
 
     /**
-     * The serialize method is called during xml writing.
+     * The xmlSerialize metod is called during xml writing.
      *
-     * It should use the $writer argument to encode this object into XML.
+     * Use the $writer argument to write its own xml serialization.
      *
-     * Important note: it is not needed to create the parent element. The
-     * parent element is already created, and we only have to worry about
-     * attributes, child elements and text (if any).
+     * An important note: do _not_ create a parent element. Any element
+     * implementing XmlSerializble should only ever write what's considered
+     * its 'inner xml'.
      *
-     * Important note 2: If you are writing any new elements, you are also
-     * responsible for closing them.
+     * The parent of the current element is responsible for writing a
+     * containing element.
+     *
+     * This allows serializers to be re-used for different element names.
+     *
+     * If you are opening new elements, you must also close them again.
      *
      * @param Writer $writer
      * @return void
      */
-    public function xmlSerialize(Writer $writer) {
+    function xmlSerialize(Writer $writer) {
 
         if (!$this->supportsLocks) return null;
 
@@ -70,32 +72,5 @@ class SupportedLock implements Element {
         ]);
 
     }
-
-    /**
-     * The deserialize method is called during xml parsing.
-     *
-     * This method is called statictly, this is because in theory this method
-     * may be used as a type of constructor, or factory method.
-     *
-     * Often you want to return an instance of the current class, but you are
-     * free to return other data as well.
-     *
-     * Important note 2: You are responsible for advancing the reader to the
-     * next element. Not doing anything will result in a never-ending loop.
-     *
-     * If you just want to skip parsing for this element altogether, you can
-     * just call $reader->next();
-     *
-     * $reader->parseInnerTree() will parse the entire sub-tree, and advance to
-     * the next element.
-     *
-     * @param Reader $reader
-     * @return mixed
-     */
-    static public function xmlDeserialize(Reader $reader) {
-
-        throw new CannotDeserialize('This element does not have a deserializer');
-
-    }
 }
 
diff --git a/lib/DAV/Xml/Property/SupportedMethodSet.php b/lib/DAV/Xml/Property/SupportedMethodSet.php
index d54c4a5..0184c21 100644
--- a/lib/DAV/Xml/Property/SupportedMethodSet.php
+++ b/lib/DAV/Xml/Property/SupportedMethodSet.php
@@ -2,12 +2,9 @@
 
 namespace Sabre\DAV\Xml\Property;
 
-use
-    Sabre\DAV,
-    Sabre\Xml\Element,
-    Sabre\Xml\Reader,
-    Sabre\Xml\Writer,
-    Sabre\Xml\Element\Elements;
+use Sabre\DAV;
+use Sabre\Xml\Writer;
+use Sabre\Xml\XmlSerializable;
 
 /**
  * supported-method-set property.
@@ -22,7 +19,7 @@ use
  * @author Evert Pot (http://evertpot.com/) 
  * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
  */
-class SupportedMethodSet implements Element {
+class SupportedMethodSet implements XmlSerializable {
 
     /**
      * List of methods
@@ -74,16 +71,20 @@ class SupportedMethodSet implements Element {
     }
 
     /**
-     * The serialize method is called during xml writing.
+     * The xmlSerialize metod is called during xml writing.
      *
-     * It should use the $writer argument to encode this object into XML.
+     * Use the $writer argument to write its own xml serialization.
      *
-     * Important note: it is not needed to create the parent element. The
-     * parent element is already created, and we only have to worry about
-     * attributes, child elements and text (if any).
+     * An important note: do _not_ create a parent element. Any element
+     * implementing XmlSerializble should only ever write what's considered
+     * its 'inner xml'.
      *
-     * Important note 2: If you are writing any new elements, you are also
-     * responsible for closing them.
+     * The parent of the current element is responsible for writing a
+     * containing element.
+     *
+     * This allows serializers to be re-used for different element names.
+     *
+     * If you are opening new elements, you must also close them again.
      *
      * @param Writer $writer
      * @return void
@@ -98,31 +99,4 @@ class SupportedMethodSet implements Element {
 
     }
 
-    /**
-     * The deserialize method is called during xml parsing.
-     *
-     * This method is called statictly, this is because in theory this method
-     * may be used as a type of constructor, or factory method.
-     *
-     * Often you want to return an instance of the current class, but you are
-     * free to return other data as well.
-     *
-     * Important note 2: You are responsible for advancing the reader to the
-     * next element. Not doing anything will result in a never-ending loop.
-     *
-     * If you just want to skip parsing for this element altogether, you can
-     * just call $reader->next();
-     *
-     * $reader->parseInnerTree() will parse the entire sub-tree, and advance to
-     * the next element.
-     *
-     * @param Reader $reader
-     * @return mixed
-     */
-    static function xmlDeserialize(Reader $reader) {
-
-        throw new CannotDeserialize('This element does not have a deserializer');
-
-    }
-
 }
diff --git a/lib/DAV/Xml/Property/SupportedReportSet.php b/lib/DAV/Xml/Property/SupportedReportSet.php
index 0b6db70..f88df69 100644
--- a/lib/DAV/Xml/Property/SupportedReportSet.php
+++ b/lib/DAV/Xml/Property/SupportedReportSet.php
@@ -2,12 +2,9 @@
 
 namespace Sabre\DAV\Xml\Property;
 
-use
-    Sabre\DAV,
-    Sabre\Xml\Element,
-    Sabre\Xml\Reader,
-    Sabre\Xml\Writer,
-    Sabre\Xml\Element\Elements;
+use Sabre\DAV;
+use Sabre\Xml\Writer;
+use Sabre\Xml\XmlSerializable;
 
 /**
  * supported-report-set property.
@@ -22,14 +19,14 @@ use
  * @author Evert Pot (http://www.rooftopsolutions.nl/)
  * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
  */
-class SupportedReportSet implements Element {
+class SupportedReportSet implements XmlSerializable {
 
     /**
      * List of reports
      *
      * @var array
      */
-    protected $reports = array();
+    protected $reports = [];
 
     /**
      * Creates the property
@@ -41,7 +38,7 @@ class SupportedReportSet implements Element {
      *
      * @param string|string[] $reports
      */
-    public function __construct($reports = null) {
+    function __construct($reports = null) {
 
         if (!is_null($reports))
             $this->addReport($reports);
@@ -57,9 +54,9 @@ class SupportedReportSet implements Element {
      * @param mixed $report
      * @return void
      */
-    public function addReport($report) {
+    function addReport($report) {
 
-        if (!is_array($report)) $report = array($report);
+        $report = (array)$report;
 
         foreach($report as $r) {
 
@@ -77,7 +74,7 @@ class SupportedReportSet implements Element {
      *
      * @return string[]
      */
-    public function getValue() {
+    function getValue() {
 
         return $this->reports;
 
@@ -89,7 +86,7 @@ class SupportedReportSet implements Element {
      * @param string $reportName
      * @return bool
      */
-    public function has($reportName) {
+    function has($reportName) {
 
         return in_array(
             $reportName,
@@ -99,21 +96,25 @@ class SupportedReportSet implements Element {
     }
 
     /**
-     * The serialize method is called during xml writing.
+     * The xmlSerialize metod is called during xml writing.
      *
-     * It should use the $writer argument to encode this object into XML.
+     * Use the $writer argument to write its own xml serialization.
      *
-     * Important note: it is not needed to create the parent element. The
-     * parent element is already created, and we only have to worry about
-     * attributes, child elements and text (if any).
+     * An important note: do _not_ create a parent element. Any element
+     * implementing XmlSerializble should only ever write what's considered
+     * its 'inner xml'.
      *
-     * Important note 2: If you are writing any new elements, you are also
-     * responsible for closing them.
+     * The parent of the current element is responsible for writing a
+     * containing element.
+     *
+     * This allows serializers to be re-used for different element names.
+     *
+     * If you are opening new elements, you must also close them again.
      *
      * @param Writer $writer
      * @return void
      */
-    public function xmlSerialize(Writer $writer) {
+    function xmlSerialize(Writer $writer) {
 
         foreach($this->getValue() as $val) {
             $writer->startElement('{DAV:}supported-report');
@@ -125,31 +126,4 @@ class SupportedReportSet implements Element {
 
     }
 
-    /**
-     * The deserialize method is called during xml parsing.
-     *
-     * This method is called statictly, this is because in theory this method
-     * may be used as a type of constructor, or factory method.
-     *
-     * Often you want to return an instance of the current class, but you are
-     * free to return other data as well.
-     *
-     * Important note 2: You are responsible for advancing the reader to the
-     * next element. Not doing anything will result in a never-ending loop.
-     *
-     * If you just want to skip parsing for this element altogether, you can
-     * just call $reader->next();
-     *
-     * $reader->parseInnerTree() will parse the entire sub-tree, and advance to
-     * the next element.
-     *
-     * @param Reader $reader
-     * @return mixed
-     */
-    static public function xmlDeserialize(Reader $reader) {
-
-        throw new CannotDeserialize('This element does not have a deserializer');
-
-    }
-
 }
diff --git a/lib/DAV/Xml/Request/MkCol.php b/lib/DAV/Xml/Request/MkCol.php
index 876b8b3..d9236d6 100644
--- a/lib/DAV/Xml/Request/MkCol.php
+++ b/lib/DAV/Xml/Request/MkCol.php
@@ -2,11 +2,8 @@
 
 namespace Sabre\DAV\Xml\Request;
 
-use
-    Sabre\Xml\Element,
-    Sabre\Xml\Reader,
-    Sabre\Xml\Writer,
-    Sabre\DAV\Exception\CannotSerialize;
+use Sabre\Xml\Reader;
+use Sabre\Xml\XmlDeserializable;
 
 /**
  * WebDAV Extended MKCOL request parser.
@@ -19,7 +16,7 @@ use
  * @author Evert Pot (http://evertpot.com/)
  * @license http://sabre.io/license/ Modified BSD License
  */
-class MkCol implements Element {
+class MkCol implements XmlDeserializable {
 
     /**
      * The list of properties that will be set.
@@ -41,27 +38,6 @@ class MkCol implements Element {
     }
 
     /**
-     * The serialize method is called during xml writing.
-     *
-     * It should use the $writer argument to encode this object into XML.
-     *
-     * Important note: it is not needed to create the parent element. The
-     * parent element is already created, and we only have to worry about
-     * attributes, child elements and text (if any).
-     *
-     * Important note 2: If you are writing any new elements, you are also
-     * responsible for closing them.
-     *
-     * @param Writer $writer
-     * @return void
-     */
-    function xmlSerialize(Writer $writer) {
-
-        throw new CannotSerialize('This element cannot be serialized.');
-
-    }
-
-    /**
      * The deserialize method is called during xml parsing.
      *
      * This method is called statictly, this is because in theory this method
@@ -70,8 +46,8 @@ class MkCol implements Element {
      * Often you want to return an instance of the current class, but you are
      * free to return other data as well.
      *
-     * Important note 2: You are responsible for advancing the reader to the
-     * next element. Not doing anything will result in a never-ending loop.
+     * You are responsible for advancing the reader to the next element. Not
+     * doing anything will result in a never-ending loop.
      *
      * If you just want to skip parsing for this element altogether, you can
      * just call $reader->next();
diff --git a/lib/DAV/Xml/Request/PropFind.php b/lib/DAV/Xml/Request/PropFind.php
index 6cc87e6..da8360d 100644
--- a/lib/DAV/Xml/Request/PropFind.php
+++ b/lib/DAV/Xml/Request/PropFind.php
@@ -2,12 +2,9 @@
 
 namespace Sabre\DAV\Xml\Request;
 
-use
-    Sabre\Xml\Element,
-    Sabre\Xml\Element\Elements,
-    Sabre\Xml\Reader,
-    Sabre\Xml\Writer,
-    Sabre\DAV\Exception\CannotSerialize;
+use Sabre\Xml\Element\Elements;
+use Sabre\Xml\Reader;
+use Sabre\Xml\XmlDeserializable;
 
 /**
  * WebDAV PROPFIND request parser.
@@ -20,7 +17,7 @@ use
  * @author Evert Pot (http://www.rooftopsolutions.nl/)
  * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
  */
-class PropFind implements Element {
+class PropFind implements XmlDeserializable {
 
     /**
      * If this is set to true, this was an 'allprop' request.
@@ -37,27 +34,6 @@ class PropFind implements Element {
     public $properties;
 
     /**
-     * The serialize method is called during xml writing.
-     *
-     * It should use the $writer argument to encode this object into XML.
-     *
-     * Important note: it is not needed to create the parent element. The
-     * parent element is already created, and we only have to worry about
-     * attributes, child elements and text (if any).
-     *
-     * Important note 2: If you are writing any new elements, you are also
-     * responsible for closing them.
-     *
-     * @param Writer $writer
-     * @return void
-     */
-    public function xmlSerialize(Writer $writer) {
-
-        throw new CannotSerialize('This element cannot be serialized.');
-
-    }
-
-    /**
      * The deserialize method is called during xml parsing.
      *
      * This method is called statictly, this is because in theory this method
@@ -66,8 +42,8 @@ class PropFind implements Element {
      * Often you want to return an instance of the current class, but you are
      * free to return other data as well.
      *
-     * Important note 2: You are responsible for advancing the reader to the
-     * next element. Not doing anything will result in a never-ending loop.
+     * You are responsible for advancing the reader to the next element. Not
+     * doing anything will result in a never-ending loop.
      *
      * If you just want to skip parsing for this element altogether, you can
      * just call $reader->next();
@@ -78,7 +54,7 @@ class PropFind implements Element {
      * @param Reader $reader
      * @return mixed
      */
-    static public function xmlDeserialize(Reader $reader) {
+    static function xmlDeserialize(Reader $reader) {
 
         $self = new self();
 
@@ -88,7 +64,6 @@ class PropFind implements Element {
 
             if ($reader->nodeType === Reader::ELEMENT) {
 
-                $clark = $reader->getClark();
                 switch($reader->getClark()) {
 
                     case '{DAV:}allprop' :
diff --git a/lib/DAV/Xml/Request/SyncCollectionReport.php b/lib/DAV/Xml/Request/SyncCollectionReport.php
index b6daffc..738bbc7 100644
--- a/lib/DAV/Xml/Request/SyncCollectionReport.php
+++ b/lib/DAV/Xml/Request/SyncCollectionReport.php
@@ -2,13 +2,10 @@
 
 namespace Sabre\DAV\Xml\Request;
 
-use
-    Sabre\Xml\Element,
-    Sabre\Xml\Reader,
-    Sabre\Xml\Writer,
-    Sabre\Xml\Element\KeyValue,
-    Sabre\DAV\Exception\CannotSerialize,
-    Sabre\DAV\Exception\BadRequest;
+use Sabre\Xml\Reader;
+use Sabre\Xml\XmlDeserializable;
+use Sabre\Xml\Element\KeyValue;
+use Sabre\DAV\Exception\BadRequest;
 
 /**
  * SyncCollection request parser.
@@ -21,7 +18,7 @@ use
  * @author Evert Pot (http://www.rooftopsolutions.nl/)
  * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
  */
-class SyncCollectionReport implements Element {
+class SyncCollectionReport implements XmlDeserializable {
 
     /**
      * The sync-token the client supplied for the report.
@@ -52,27 +49,6 @@ class SyncCollectionReport implements Element {
     public $properties;
 
     /**
-     * The serialize method is called during xml writing.
-     *
-     * It should use the $writer argument to encode this object into XML.
-     *
-     * Important note: it is not needed to create the parent element. The
-     * parent element is already created, and we only have to worry about
-     * attributes, child elements and text (if any).
-     *
-     * Important note 2: If you are writing any new elements, you are also
-     * responsible for closing them.
-     *
-     * @param Writer $writer
-     * @return void
-     */
-    public function xmlSerialize(Writer $writer) {
-
-        throw new CannotSerialize('This element cannot be serialized.');
-
-    }
-
-    /**
      * The deserialize method is called during xml parsing.
      *
      * This method is called statictly, this is because in theory this method
@@ -81,8 +57,8 @@ class SyncCollectionReport implements Element {
      * Often you want to return an instance of the current class, but you are
      * free to return other data as well.
      *
-     * Important note 2: You are responsible for advancing the reader to the
-     * next element. Not doing anything will result in a never-ending loop.
+     * You are responsible for advancing the reader to the next element. Not
+     * doing anything will result in a never-ending loop.
      *
      * If you just want to skip parsing for this element altogether, you can
      * just call $reader->next();
@@ -93,7 +69,7 @@ class SyncCollectionReport implements Element {
      * @param Reader $reader
      * @return mixed
      */
-    static public function xmlDeserialize(Reader $reader) {
+    static function xmlDeserialize(Reader $reader) {
 
         $self = new self();
 
diff --git a/lib/DAV/Xml/Response/MultiStatus.php b/lib/DAV/Xml/Response/MultiStatus.php
index f33c89b..2f157ce 100644
--- a/lib/DAV/Xml/Response/MultiStatus.php
+++ b/lib/DAV/Xml/Response/MultiStatus.php
@@ -2,11 +2,9 @@
 
 namespace Sabre\DAV\Xml\Response;
 
-use
-    Sabre\Xml\Element,
-    Sabre\Xml\Reader,
-    Sabre\Xml\Writer,
-    Sabre\DAV\Exception\CannotSerialize;
+use Sabre\Xml\Element;
+use Sabre\Xml\Reader;
+use Sabre\Xml\Writer;
 
 /**
  * WebDAV MultiStatus parser
@@ -106,8 +104,8 @@ class MultiStatus implements Element {
      * Often you want to return an instance of the current class, but you are
      * free to return other data as well.
      *
-     * Important note 2: You are responsible for advancing the reader to the
-     * next element. Not doing anything will result in a never-ending loop.
+     * You are responsible for advancing the reader to the next element. Not
+     * doing anything will result in a never-ending loop.
      *
      * If you just want to skip parsing for this element altogether, you can
      * just call $reader->next();
diff --git a/lib/DAVACL/Xml/Property/AclRestrictions.php b/lib/DAVACL/Xml/Property/AclRestrictions.php
index 3d61e09..c7ed110 100644
--- a/lib/DAVACL/Xml/Property/AclRestrictions.php
+++ b/lib/DAVACL/Xml/Property/AclRestrictions.php
@@ -2,10 +2,8 @@
 
 namespace Sabre\DAVACL\Xml\Property;
 
-use
-    Sabre\DAV,
-    Sabre\Xml\XmlSerializable,
-    Sabre\Xml\Writer;
+use Sabre\Xml\XmlSerializable;
+use Sabre\Xml\Writer;
 
 /**
  * AclRestrictions property
diff --git a/lib/DAVACL/Xml/Property/CurrentUserPrivilegeSet.php b/lib/DAVACL/Xml/Property/CurrentUserPrivilegeSet.php
index 20750cc..53a4b33 100644
--- a/lib/DAVACL/Xml/Property/CurrentUserPrivilegeSet.php
+++ b/lib/DAVACL/Xml/Property/CurrentUserPrivilegeSet.php
@@ -2,11 +2,9 @@
 
 namespace Sabre\DAVACL\Xml\Property;
 
-use
-    Sabre\DAV,
-    Sabre\Xml\Element,
-    Sabre\Xml\Reader,
-    Sabre\Xml\Writer;
+use Sabre\Xml\Element;
+use Sabre\Xml\Reader;
+use Sabre\Xml\Writer;
 
 /**
  * CurrentUserPrivilegeSet
@@ -104,8 +102,8 @@ class CurrentUserPrivilegeSet implements Element {
      * Often you want to return an instance of the current class, but you are
      * free to return other data as well.
      *
-     * Important note 2: You are responsible for advancing the reader to the
-     * next element. Not doing anything will result in a never-ending loop.
+     * You are responsible for advancing the reader to the next element. Not
+     * doing anything will result in a never-ending loop.
      *
      * If you just want to skip parsing for this element altogether, you can
      * just call $reader->next();
diff --git a/lib/DAVACL/Xml/Property/Principal.php b/lib/DAVACL/Xml/Property/Principal.php
index eb22f98..33e90c9 100644
--- a/lib/DAVACL/Xml/Property/Principal.php
+++ b/lib/DAVACL/Xml/Property/Principal.php
@@ -2,12 +2,10 @@
 
 namespace Sabre\DAVACL\Xml\Property;
 
-use
-    Sabre\DAV,
-    Sabre\DAV\Exception\BadRequest,
-    Sabre\Xml\Element,
-    Sabre\Xml\Reader,
-    Sabre\Xml\Writer;
+use Sabre\DAV;
+use Sabre\DAV\Exception\BadRequest;
+use Sabre\Xml\Reader;
+use Sabre\Xml\Writer;
 
 /**
  * Principal property
diff --git a/lib/DAVACL/Xml/Property/SupportedPrivilegeSet.php b/lib/DAVACL/Xml/Property/SupportedPrivilegeSet.php
index e76c206..8e031cf 100644
--- a/lib/DAVACL/Xml/Property/SupportedPrivilegeSet.php
+++ b/lib/DAVACL/Xml/Property/SupportedPrivilegeSet.php
@@ -2,11 +2,8 @@
 
 namespace Sabre\DAVACL\Xml\Property;
 
-use
-    Sabre\DAV,
-    Sabre\Xml\XmlSerializable,
-    Sabre\Xml\Reader,
-    Sabre\Xml\Writer;
+use Sabre\Xml\XmlSerializable;
+use Sabre\Xml\Writer;
 
 /**
  * SupportedPrivilegeSet property

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/php-sabredav.git



More information about the Pkg-owncloud-commits mailing list