[Pkg-owncloud-commits] [php-sabre-vobject] 11/341: Dropped a few more clone statements, where we know it's safe.

David Prévot taffit at moszumanska.debian.org
Tue Aug 11 13:35:26 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 2d8f6ecbc56816e5a9a827d26e674fb00ec7487d
Author: Evert Pot <evert at rooftopsolutions.nl>
Date:   Sat Sep 20 14:26:17 2014 +0100

    Dropped a few more clone statements, where we know it's safe.
---
 lib/Component/VEvent.php    | 8 +++-----
 lib/Component/VFreeBusy.php | 4 +---
 lib/Component/VJournal.php  | 2 +-
 lib/Component/VTodo.php     | 3 +--
 4 files changed, 6 insertions(+), 11 deletions(-)

diff --git a/lib/Component/VEvent.php b/lib/Component/VEvent.php
index ce6b5be..6735036 100644
--- a/lib/Component/VEvent.php
+++ b/lib/Component/VEvent.php
@@ -56,13 +56,11 @@ class VEvent extends VObject\Component {
             $effectiveEnd = $this->DTEND->getDateTime();
 
         } elseif (isset($this->DURATION)) {
-            $effectiveEnd = clone $effectiveStart;
-            $effectiveEnd = $effectiveEnd->add(VObject\DateTimeParser::parseDuration($this->DURATION));
+            $effectiveEnd = $effectiveStart->add(VObject\DateTimeParser::parseDuration($this->DURATION));
         } elseif (!$this->DTSTART->hasTime()) {
-            $effectiveEnd = clone $effectiveStart;
-            $effectiveEnd = $effectiveEnd->modify('+1 day');
+            $effectiveEnd = $effectiveStart->modify('+1 day');
         } else {
-            $effectiveEnd = clone $effectiveStart;
+            $effectiveEnd = $effectiveStart;
         }
         return (
             ($start <= $effectiveEnd) && ($end > $effectiveStart)
diff --git a/lib/Component/VFreeBusy.php b/lib/Component/VFreeBusy.php
index 7a360ff..96a7f27 100644
--- a/lib/Component/VFreeBusy.php
+++ b/lib/Component/VFreeBusy.php
@@ -48,9 +48,7 @@ class VFreeBusy extends VObject\Component {
                 $busyStart = VObject\DateTimeParser::parse($busyStart);
                 $busyEnd = VObject\DateTimeParser::parse($busyEnd);
                 if ($busyEnd instanceof \DateInterval) {
-                    $tmp = clone $busyStart;
-                    $tmp = $tmp->add($busyEnd);
-                    $busyEnd = $tmp;
+                    $busyEnd = $busyStart->add($busyEnd);
                 }
 
                 if($start < $busyEnd && $end > $busyStart) {
diff --git a/lib/Component/VJournal.php b/lib/Component/VJournal.php
index 92f8a80..181fb48 100644
--- a/lib/Component/VJournal.php
+++ b/lib/Component/VJournal.php
@@ -31,7 +31,7 @@ class VJournal extends VObject\Component {
 
         $dtstart = isset($this->DTSTART)?$this->DTSTART->getDateTime():null;
         if ($dtstart) {
-            $effectiveEnd = clone $dtstart;
+            $effectiveEnd = $dtstart;
             if (!$this->DTSTART->hasTime()) {
                 $effectiveEnd = $effectiveEnd->modify('+1 day');
             }
diff --git a/lib/Component/VTodo.php b/lib/Component/VTodo.php
index c0cb318..9e00c5b 100644
--- a/lib/Component/VTodo.php
+++ b/lib/Component/VTodo.php
@@ -37,8 +37,7 @@ class VTodo extends VObject\Component {
 
         if ($dtstart) {
             if ($duration) {
-                $effectiveEnd = clone $dtstart;
-                $effectiveEnd = $effectiveEnd->add($duration);
+                $effectiveEnd = $dtstart->add($duration);
                 return $start <= $effectiveEnd && $end > $dtstart;
             } elseif ($due) {
                 return

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