[Pkg-owncloud-commits] [php-sabre-vobject] 26/65: Add the validate rule about DTEND and DURATION.

David Prévot taffit at moszumanska.debian.org
Tue Feb 24 23:57:15 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 38d589baea0ea652364b40284ea3972a39cfd6f1
Author: Ivan Enderlin <ivan.enderlin at hoa-project.net>
Date:   Fri Jan 30 14:36:51 2015 +0100

    Add the validate rule about DTEND and DURATION.
---
 lib/Component/VAvailability.php | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/lib/Component/VAvailability.php b/lib/Component/VAvailability.php
index f687016..8780d12 100644
--- a/lib/Component/VAvailability.php
+++ b/lib/Component/VAvailability.php
@@ -57,4 +57,43 @@ class VAvailability extends VObject\Component {
         ];
 
     }
+
+    /**
+     * Validates the node for correctness.
+     *
+     * The following options are supported:
+     *   Node::REPAIR - May attempt to automatically repair the problem.
+     *   Node::PROFILE_CARDDAV - Validate the vCard for CardDAV purposes.
+     *   Node::PROFILE_CALDAV - Validate the iCalendar for CalDAV purposes.
+     *
+     * This method returns an array with detected problems.
+     * Every element has the following properties:
+     *
+     *  * level - problem level.
+     *  * message - A human-readable string describing the issue.
+     *  * node - A reference to the problematic node.
+     *
+     * The level means:
+     *   1 - The issue was repaired (only happens if REPAIR was turned on).
+     *   2 - A warning.
+     *   3 - An error.
+     *
+     * @param int $options
+     * @return array
+     */
+    function validate($options = 0) {
+
+        $result = parent::validate($options);
+
+        if (isset($this->DTEND) && isset($this->DURATION)) {
+            $result[] = [
+                'level' => 3,
+                'message' => 'DTEND and DURATION cannot both be present',
+                'node' => $this
+            ];
+        }
+
+        return $result;
+
+    }
 }

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