[Pkg-owncloud-commits] [php-sabre-vobject] 264/341: Merge branch '3.4'
David Prévot
taffit at moszumanska.debian.org
Tue Aug 11 13:35:55 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 f998baee569ab9b75111ee6033320569f71b3410
Merge: bcd7906 09363e9
Author: Evert Pot <me at evertpot.com>
Date: Tue Feb 17 22:54:24 2015 -0500
Merge branch '3.4'
Conflicts:
ChangeLog.md
lib/Component/VCalendar.php
lib/DateTimeParser.php
lib/Recur/EventIterator.php
lib/Version.php
tests/VObject/DateTimeParserTest.php
ChangeLog.md | 12 +-
bin/rrulebench.php | 32 ++
lib/Component/Available.php | 108 ++++++
lib/Component/VAlarm.php | 1 +
lib/Component/VAvailability.php | 99 ++++++
lib/Component/VCalendar.php | 78 +++--
lib/Component/VCard.php | 1 +
lib/Component/VEvent.php | 2 +-
lib/Component/VFreeBusy.php | 1 +
lib/Component/VJournal.php | 1 +
lib/Component/VTimeZone.php | 1 +
lib/Component/VTodo.php | 1 +
lib/DateTimeParser.php | 13 +-
lib/FreeBusyGenerator.php | 14 +-
lib/ITip/Broker.php | 20 +-
lib/Recur/EventIterator.php | 32 +-
lib/timezonedata/windowszones.php | 6 +-
tests/VObject/Component/VAlarmTest.php | 2 +-
tests/VObject/Component/VAvailabilityTest.php | 387 +++++++++++++++++++++
tests/VObject/DateTimeParserTest.php | 29 ++
tests/VObject/FreeBusyGeneratorTest.php | 18 +
tests/VObject/ITip/BrokerUpdateEventTest.php | 91 +++++
.../EventIterator/ExpandFloatingTimesTest.php | 4 +-
tests/VObject/Recur/EventIterator/MainTest.php | 2 +-
tests/VObject/TimeZoneUtilTest.php | 13 +-
25 files changed, 915 insertions(+), 53 deletions(-)
diff --cc ChangeLog.md
index 2f2cfae,32580a5..28ee356
--- a/ChangeLog.md
+++ b/ChangeLog.md
@@@ -1,27 -1,15 +1,33 @@@
ChangeLog
=========
+4.0.0-alpha1
+------------
+
+* sabre/vobject now requires PHP 5.5.
+* #160: Support for xCal! (@Hywan)
+* #192: Support for xCard! (@Hywan)
+* #186: Fixing conversion of `UTC-OFFSET` properties when going back and
+ forward between jCal and iCalendar.
+* Properties, Components and Parameters now implement PHP's `JsonSerializable`
+ interface.
+* #139: We now accept `DateTimeInterface` whereever it accepted `DateTime`
+ before in arguments. This means that either `DateTime` or
+ `DateTimeImmutable` may be used everywhere.
+* #139: We now _always_ return `DateTimeImmutable` from any method. This could
+ potentially have big implications if you manipulate Date objects anywhere.
+* #161: Simplified `ElementList` by extending `ArrayIterator`.
+
+
- 3.3.6 (2015-??-??)
+ 3.4.0 (2015-??-??)
------------------
+ * #196: Made parsing recurrence rules a lot faster on big calendars.
+ * Updated windows timezone mappings to latest unicode version.
+ * #202: Support for parsing and validating `VAVAILABILITY` components. (@Hywan)
+ * #195: PHP 5.3 compatibility in 'generatevcards' script. (@rickdenhaan)
+ * #205: Improving handling of multiple `EXDATE` when processing iTip changes.
+ (@armin-hackmann)
* #187: Fixed validator rules for `LAST-MODIFIED` properties.
* #188: Retain floating times when generating instances using
`Recur\EventIterator`.
diff --cc lib/Component/VCalendar.php
index 1aa847c,ade1ad0..3d7e801
--- a/lib/Component/VCalendar.php
+++ b/lib/Component/VCalendar.php
@@@ -34,14 -34,16 +34,16 @@@ class VCalendar extends VObject\Documen
*
* @var array
*/
- static $componentMap = array(
+ static $componentMap = [
- 'VALARM' => 'Sabre\\VObject\\Component\\VAlarm',
- 'VEVENT' => 'Sabre\\VObject\\Component\\VEvent',
- 'VFREEBUSY' => 'Sabre\\VObject\\Component\\VFreeBusy',
- 'VJOURNAL' => 'Sabre\\VObject\\Component\\VJournal',
- 'VTIMEZONE' => 'Sabre\\VObject\\Component\\VTimeZone',
- 'VTODO' => 'Sabre\\VObject\\Component\\VTodo',
+ 'VALARM' => 'Sabre\\VObject\\Component\\VAlarm',
+ 'VEVENT' => 'Sabre\\VObject\\Component\\VEvent',
+ 'VFREEBUSY' => 'Sabre\\VObject\\Component\\VFreeBusy',
+ 'VAVAILABILITY' => 'Sabre\\VObject\\Component\\VAvailability',
+ 'AVAILABLE' => 'Sabre\\VObject\\Component\\Available',
+ 'VJOURNAL' => 'Sabre\\VObject\\Component\\VJournal',
+ 'VTIMEZONE' => 'Sabre\\VObject\\Component\\VTimeZone',
+ 'VTODO' => 'Sabre\\VObject\\Component\\VTodo',
- );
+ ];
/**
* List of value-types, and which classes they map to.
@@@ -143,7 -145,10 +145,10 @@@
'PROXIMITY' => 'Sabre\\VObject\\Property\\Text',
'DEFAULT-ALARM' => 'Sabre\\VObject\\Property\\Boolean',
+ // Additions from draft-daboo-calendar-availability-05
+ 'BUSYTYPE' => 'Sabre\\VObject\\Property\\Text',
+
- );
+ ];
/**
* Returns the current document type.
@@@ -253,10 -258,23 +258,23 @@@
$timeZone = new DateTimeZone('UTC');
}
+ // An array of events. Events are indexed by UID. Each item in this
+ // array is a list of one or more events that match the UID.
- $recurringEvents = array();
++ $recurringEvents = [];
+
foreach($this->select('VEVENT') as $key=>$vevent) {
- if (isset($vevent->{'RECURRENCE-ID'})) {
- unset($this->children[$key]);
+ $uid = (string)$vevent->UID;
+ if (!$uid) {
+ throw new \LogicException('Event did not have a UID!');
+ }
+
+ if (isset($vevent->{'RECURRENCE-ID'}) || isset($vevent->RRULE)) {
+ if (isset($recurringEvents[$uid])) {
+ $recurringEvents[$uid][] = $vevent;
+ } else {
- $recurringEvents[$uid] = array($vevent);
++ $recurringEvents[$uid] = [$vevent];
+ }
continue;
}
@@@ -309,11 -325,11 +325,10 @@@
// We only need to update the first timezone, because
// setDateTimes will match all other timezones to the
// first.
- $dt[0]->setTimeZone(new DateTimeZone('UTC'));
+ $dt[0] = $dt[0]->setTimeZone(new DateTimeZone('UTC'));
$child->setDateTimes($dt);
}
-
}
-
$this->add($newEvent);
}
diff --cc lib/DateTimeParser.php
index 059d810,8973600..d022138
--- a/lib/DateTimeParser.php
+++ b/lib/DateTimeParser.php
@@@ -263,17 -250,18 +263,18 @@@ class DateTimeParser
$regex = '/^
(?: # date part
(?:
- (?: (?P<year> [0-9]{4}) (?: -)?| --)
- (?P<month> [0-9]{2})?
+ (?: (?<year> [0-9]{4}) (?: -)?| --)
+ (?<month> [0-9]{2})?
|---)
- (?P<date> [0-9]{2})?
+ (?<date> [0-9]{2})?
)?
(?:T # time part
- (?P<hour> [0-9]{2} | -)
- (?P<minute> [0-9]{2} | -)?
- (?P<second> [0-9]{2})?
+ (?<hour> [0-9]{2} | -)
+ (?<minute> [0-9]{2} | -)?
+ (?<second> [0-9]{2})?
- (?<timezone> # timezone offset
+ (?: \.[0-9]{3})? # milliseconds
+ (?P<timezone> # timezone offset
Z | (?: \+|-)(?: [0-9]{4})
@@@ -294,11 -281,12 +294,12 @@@
)?
(?:T # time part
- (?: (?P<hour> [0-9]{2}) : | -)
- (?: (?P<minute> [0-9]{2}) : | -)?
- (?P<second> [0-9]{2})?
+ (?: (?<hour> [0-9]{2}) : | -)
+ (?: (?<minute> [0-9]{2}) : | -)?
+ (?<second> [0-9]{2})?
- (?<timezone> # timezone offset
+ (?: \.[0-9]{3})? # milliseconds
+ (?P<timezone> # timezone offset
Z | (?: \+|-)(?: [0-9]{2}:[0-9]{2})
@@@ -380,14 -368,15 +381,15 @@@
* @param string $date
* @return array
*/
- static public function parseVCardTime($date) {
+ static function parseVCardTime($date) {
$regex = '/^
- (?P<hour> [0-9]{2} | -)
- (?P<minute> [0-9]{2} | -)?
- (?P<second> [0-9]{2})?
+ (?<hour> [0-9]{2} | -)
+ (?<minute> [0-9]{2} | -)?
+ (?<second> [0-9]{2})?
- (?<timezone> # timezone offset
+ (?: \.[0-9]{3})? # milliseconds
+ (?P<timezone> # timezone offset
Z | (?: \+|-)(?: [0-9]{4})
@@@ -399,11 -388,12 +401,12 @@@
// Attempting to parse the extended format.
$regex = '/^
- (?: (?P<hour> [0-9]{2}) : | -)
- (?: (?P<minute> [0-9]{2}) : | -)?
- (?P<second> [0-9]{2})?
+ (?: (?<hour> [0-9]{2}) : | -)
+ (?: (?<minute> [0-9]{2}) : | -)?
+ (?<second> [0-9]{2})?
- (?<timezone> # timezone offset
+ (?: \.[0-9]{3})? # milliseconds
+ (?P<timezone> # timezone offset
Z | (?: \+|-)(?: [0-9]{2}:[0-9]{2})
diff --cc lib/FreeBusyGenerator.php
index 5d24d27,c1c4541..aa5a211
--- a/lib/FreeBusyGenerator.php
+++ b/lib/FreeBusyGenerator.php
@@@ -176,11 -176,11 +177,11 @@@ class FreeBusyGenerator
*
* @return Component
*/
- public function getResult() {
+ function getResult() {
- $busyTimes = array();
+ $busyTimes = [];
- foreach($this->objects as $object) {
+ foreach($this->objects as $key=>$object) {
foreach($object->getBaseComponents() as $component) {
@@@ -202,11 -202,19 +203,19 @@@
}
}
- $times = array();
+ $times = [];
if ($component->RRULE) {
+ try {
+ $iterator = new EventIterator($object, (string)$component->uid, $this->timeZone);
+ } catch (NoInstancesException $e) {
+ // This event is recurring, but it doesn't have a single
+ // instance. We are skipping this event from the output
+ // entirely.
+ unset($this->objects[$key]);
+ continue;
+ }
- $iterator = new EventIterator($object, (string)$component->uid, $this->timeZone);
if ($this->start) {
$iterator->fastForward($this->start);
}
diff --cc lib/Recur/EventIterator.php
index d3b311d,e5b5d87..32001f8
--- a/lib/Recur/EventIterator.php
+++ b/lib/Recur/EventIterator.php
@@@ -82,17 -89,20 +90,20 @@@ class EventIterator implements \Iterato
* @param DateTimeZone $timeZone Reference timezone for floating dates and
* times.
*/
- function __construct(Component $vcal, $uid = null, DateTimeZone $timeZone = null) {
- public function __construct($input, $uid = null, DateTimeZone $timeZone = null) {
++ function __construct($input, $uid = null, DateTimeZone $timeZone = null) {
if (is_null($this->timeZone)) {
$timeZone = new DateTimeZone('UTC');
}
$this->timeZone = $timeZone;
- if ($vcal instanceof VEvent) {
+ if (is_array($input)) {
+ $events = $input;
+ } elseif ($input instanceof VEvent) {
// Single instance mode.
- $events = [$vcal];
- $events = array($input);
++ $events = [$input];
} else {
+ // Calendar + UID mode.
$uid = (string)$uid;
if (!$uid) {
throw new InvalidArgumentException('The UID argument is required when a VCALENDAR is passed to this constructor');
diff --cc tests/VObject/DateTimeParserTest.php
index a08a9a9,4b90d87..bcdb6b4
--- a/tests/VObject/DateTimeParserTest.php
+++ b/tests/VObject/DateTimeParserTest.php
@@@ -379,279 -379,37 +379,308 @@@ class DateTimeParserTest extends \PHPUn
"minute" => 10,
"second" => 53,
"timezone" => 'Z'
- ),
- ),
+ ],
+ ],
+
+ // with milliseconds
- array(
++ [
+ "20121129T151053.123Z",
- array(
++ [
+ "year" => 2012,
+ "month" => 11,
+ "date" => 29,
+ "hour" => 15,
+ "minute" => 10,
+ "second" => 53,
+ "timezone" => 'Z'
- ),
- ),
++ ],
++ ],
+
+ // extended format with milliseconds
- array(
++ [
+ "2012-11-29T15:10:53.123Z",
- array(
++ [
+ "year" => 2012,
+ "month" => 11,
+ "date" => 29,
+ "hour" => 15,
+ "minute" => 10,
+ "second" => 53,
+ "timezone" => 'Z'
- ),
- ),
++ ],
++ ],
+ ];
+ }
+
+ function testDateAndOrTime_DateWithYearMonthDay() {
+
+ $this->assertDateAndOrTimeEqualsTo(
+ '20150128',
+ [
+ 'year' => '2015',
+ 'month' => '01',
+ 'date' => '28'
+ ]
+ );
+
+ }
+
+ function testDateAndOrTime_DateWithYearMonth() {
+
+ $this->assertDateAndOrTimeEqualsTo(
+ '2015-01',
+ [
+ 'year' => '2015',
+ 'month' => '01'
+ ]
+ );
+
+ }
+
+ function testDateAndOrTime_DateWithMonth() {
+
+ $this->assertDateAndOrTimeEqualsTo(
+ '--01',
+ [
+ 'month' => '01'
+ ]
+ );
+
+ }
+
+ function testDateAndOrTime_DateWithMonthDay() {
+
+ $this->assertDateAndOrTimeEqualsTo(
+ '--0128',
+ [
+ 'month' => '01',
+ 'date' => '28'
+ ]
+ );
+
+ }
+
+ function testDateAndOrTime_DateWithDay() {
+
+ $this->assertDateAndOrTimeEqualsTo(
+ '---28',
+ [
+ 'date' => '28'
+ ]
+ );
+
+ }
+
+ function testDateAndOrTime_TimeWithHour() {
+
+ $this->assertDateAndOrTimeEqualsTo(
+ '13',
+ [
+ 'hour' => '13'
+ ]
+ );
+
+ }
+
+ function testDateAndOrTime_TimeWithHourMinute() {
+
+ $this->assertDateAndOrTimeEqualsTo(
+ '1353',
+ [
+ 'hour' => '13',
+ 'minute' => '53'
+ ]
+ );
+
+ }
+
+ function testDateAndOrTime_TimeWithHourSecond() {
+
+ $this->assertDateAndOrTimeEqualsTo(
+ '135301',
+ [
+ 'hour' => '13',
+ 'minute' => '53',
+ 'second' => '01'
+ ]
++
+ );
+
+ }
+
+ function testDateAndOrTime_TimeWithMinute() {
+
+ $this->assertDateAndOrTimeEqualsTo(
+ '-53',
+ [
+ 'minute' => '53'
+ ]
+ );
+
+ }
+
+ function testDateAndOrTime_TimeWithMinuteSecond() {
+
+ $this->assertDateAndOrTimeEqualsTo(
+ '-5301',
+ [
+ 'minute' => '53',
+ 'second' => '01'
+ ]
+ );
+
+ }
+
+ function testDateAndOrTime_TimeWithSecond() {
+
+ $this->assertTrue(true);
+
+ /**
+ * This is unreachable due to a conflict between date and time pattern.
+ * This is an error in the specification, not in our implementation.
+ $this->assertDateAndOrTimeEqualsTo(
+ '--01',
+ [
+ 'second' => '01'
+ ]
+ );
+ */
+
+ }
+
+ function testDateAndOrTime_TimeWithSecondZ() {
+
+ $this->assertDateAndOrTimeEqualsTo(
+ '--01Z',
+ [
+ 'second' => '01',
+ 'timezone' => 'Z'
+ ]
+ );
+
+ }
+
+ function testDateAndOrTime_TimeWithSecondTZ() {
+
+ $this->assertDateAndOrTimeEqualsTo(
+ '--01+1234',
+ [
+ 'second' => '01',
+ 'timezone' => '+1234'
+ ]
+ );
+
+ }
+
+ function testDateAndOrTime_DateTimeWithYearMonthDayHour() {
+
+ $this->assertDateAndOrTimeEqualsTo(
+ '20150128T13',
+ [
+ 'year' => '2015',
+ 'month' => '01',
+ 'date' => '28',
+ 'hour' => '13'
+ ]
+ );
+
+ }
+
+ function testDateAndOrTime_DateTimeWithMonthDayHour() {
+
+ $this->assertDateAndOrTimeEqualsTo(
+ '--0128T13',
+ [
+ 'month' => '01',
+ 'date' => '28',
+ 'hour' => '13'
+ ]
+ );
+
+ }
+
+ function testDateAndOrTime_DateTimeWithDayHour() {
+
+ $this->assertDateAndOrTimeEqualsTo(
+ '---28T13',
+ [
+ 'date' => '28',
+ 'hour' => '13'
+ ]
+ );
+
+ }
+
+ function testDateAndOrTime_DateTimeWithDayHourMinute() {
+
+ $this->assertDateAndOrTimeEqualsTo(
+ '---28T1353',
+ [
+ 'date' => '28',
+ 'hour' => '13',
+ 'minute' => '53'
+ ]
+ );
+
+ }
+
+ function testDateAndOrTime_DateTimeWithDayHourMinuteSecond() {
+
+ $this->assertDateAndOrTimeEqualsTo(
+ '---28T135301',
+ [
+ 'date' => '28',
+ 'hour' => '13',
+ 'minute' => '53',
+ 'second' => '01'
+ ]
+ );
+
+ }
+
+ function testDateAndOrTime_DateTimeWithDayHourZ() {
+
+ $this->assertDateAndOrTimeEqualsTo(
+ '---28T13Z',
+ [
+ 'date' => '28',
+ 'hour' => '13',
+ 'timezone' => 'Z'
+ ]
+ );
+
+ }
+
+ function testDateAndOrTime_DateTimeWithDayHourTZ() {
+
+ $this->assertDateAndOrTimeEqualsTo(
+ '---28T13+1234',
+ [
+ 'date' => '28',
+ 'hour' => '13',
+ 'timezone' => '+1234'
+ ]
+ );
+
+ }
+
+ protected function assertDateAndOrTimeEqualsTo($date, $parts) {
+
+ $this->assertSame(
+ DateTimeParser::parseVCardDateAndOrTime($date),
+ array_merge(
+ [
+ 'year' => null,
+ 'month' => null,
+ 'date' => null,
+ 'hour' => null,
+ 'minute' => null,
+ 'second' => null,
+ 'timezone' => null
+ ],
+ $parts
+ )
);
}
diff --cc tests/VObject/Recur/EventIterator/MainTest.php
index 464e967,3ffe35b..8a0dfd3
--- a/tests/VObject/Recur/EventIterator/MainTest.php
+++ b/tests/VObject/Recur/EventIterator/MainTest.php
@@@ -1,8 -1,8 +1,8 @@@
<?php
- namespace Sabre\VObject\EventIterator;
+ namespace Sabre\VObject\Recur\EventIterator;
-use DateTime;
+use DateTimeImmutable;
use DateTimeZone;
use Sabre\VObject\Recur\EventIterator;
use Sabre\VObject\Component\VCalendar;
--
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