[Pkg-owncloud-commits] [php-sabre-vobject] 04/341: Moving to DateTimeImmutable. (wip)
David Prévot
taffit at moszumanska.debian.org
Tue Aug 11 13:35:25 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 64be8338ce234ccd628f87ec53703fde4ee74235
Author: Evert Pot <evert at rooftopsolutions.nl>
Date: Fri Sep 19 12:34:43 2014 +0100
Moving to DateTimeImmutable. (wip)
---
lib/Component/VAlarm.php | 29 ++++++++++++++++-------------
lib/Component/VCalendar.php | 14 +++++++-------
2 files changed, 23 insertions(+), 20 deletions(-)
diff --git a/lib/Component/VAlarm.php b/lib/Component/VAlarm.php
index 58d3de9..9ea9ac0 100644
--- a/lib/Component/VAlarm.php
+++ b/lib/Component/VAlarm.php
@@ -1,7 +1,10 @@
<?php
namespace Sabre\VObject\Component;
+
use Sabre\VObject;
+use DateTimeInterface;
+use DateTimeImmutable;
/**
* VAlarm component
@@ -19,7 +22,7 @@ class VAlarm extends VObject\Component {
*
* This ignores repeated alarm, only the first trigger is returned.
*
- * @return DateTime
+ * @return DateTimeImmutable
*/
function getEffectiveTriggerTime() {
@@ -37,8 +40,8 @@ class VAlarm extends VObject\Component {
$propName = 'DTSTART';
}
- $effectiveTrigger = clone $parentComponent->$propName->getDateTime();
- $effectiveTrigger->add($triggerDuration);
+ $effectiveTrigger = $parentComponent->$propName->getDateTime();
+ $effectiveTrigger = $effectiveTrigger->add($triggerDuration);
} else {
if ($parentComponent->name === 'VTODO') {
$endProp = 'DUE';
@@ -49,16 +52,16 @@ class VAlarm extends VObject\Component {
}
if (isset($parentComponent->$endProp)) {
- $effectiveTrigger = clone $parentComponent->$endProp->getDateTime();
- $effectiveTrigger->add($triggerDuration);
+ $effectiveTrigger = $parentComponent->$endProp->getDateTime();
+ $effectiveTrigger = $effectiveTrigger->add($triggerDuration);
} elseif (isset($parentComponent->DURATION)) {
- $effectiveTrigger = clone $parentComponent->DTSTART->getDateTime();
+ $effectiveTrigger = $parentComponent->DTSTART->getDateTime();
$duration = VObject\DateTimeParser::parseDuration($parentComponent->DURATION);
- $effectiveTrigger->add($duration);
- $effectiveTrigger->add($triggerDuration);
+ $effectiveTrigger = $effectiveTrigger->add($duration);
+ $effectiveTrigger = $effectiveTrigger->add($triggerDuration);
} else {
- $effectiveTrigger = clone $parentComponent->DTSTART->getDateTime();
- $effectiveTrigger->add($triggerDuration);
+ $effectiveTrigger = $parentComponent->DTSTART->getDateTime();
+ $effectiveTrigger = $effectiveTrigger->add($triggerDuration);
}
}
} else {
@@ -75,11 +78,11 @@ class VAlarm extends VObject\Component {
* The rules used to determine if an event falls within the specified
* time-range is based on the CalDAV specification.
*
- * @param \DateTime $start
- * @param \DateTime $end
+ * @param DateTime $start
+ * @param DateTime $end
* @return bool
*/
- function isInTimeRange(\DateTime $start, \DateTime $end) {
+ function isInTimeRange(DateTimeInterface $start, DateTimeIterface $end) {
$effectiveTrigger = $this->getEffectiveTriggerTime();
diff --git a/lib/Component/VCalendar.php b/lib/Component/VCalendar.php
index c3d3ba1..3709dd9 100644
--- a/lib/Component/VCalendar.php
+++ b/lib/Component/VCalendar.php
@@ -2,10 +2,10 @@
namespace Sabre\VObject\Component;
-use
- Sabre\VObject,
- Sabre\VObject\Component,
- Sabre\VObject\Recur\EventIterator;
+use DateTimeInterface;
+use Sabre\VObject;
+use Sabre\VObject\Component;
+use Sabre\VObject\Recur\EventIterator;
/**
* The VCalendar component
@@ -237,11 +237,11 @@ class VCalendar extends VObject\Document {
* possible for clients to request expand events, if they are rather simple
* clients and do not have the possibility to calculate recurrences.
*
- * @param DateTime $start
- * @param DateTime $end
+ * @param DateTimeInterface $start
+ * @param DateTimeInterface $end
* @return void
*/
- function expand(\DateTime $start, \DateTime $end) {
+ function expand(DateTimeInterface $start, DateTimeInterface $end) {
$newEvents = [];
--
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