aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/sabre/dav/lib/CalDAV
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/sabre/dav/lib/CalDAV')
-rw-r--r--vendor/sabre/dav/lib/CalDAV/Backend/AbstractBackend.php70
-rw-r--r--vendor/sabre/dav/lib/CalDAV/Backend/BackendInterface.php57
-rw-r--r--vendor/sabre/dav/lib/CalDAV/Backend/NotificationSupport.php28
-rw-r--r--vendor/sabre/dav/lib/CalDAV/Backend/PDO.php564
-rw-r--r--vendor/sabre/dav/lib/CalDAV/Backend/SchedulingSupport.php19
-rw-r--r--vendor/sabre/dav/lib/CalDAV/Backend/SharingSupport.php22
-rw-r--r--vendor/sabre/dav/lib/CalDAV/Backend/SimplePDO.php112
-rw-r--r--vendor/sabre/dav/lib/CalDAV/Backend/SubscriptionSupport.php25
-rw-r--r--vendor/sabre/dav/lib/CalDAV/Backend/SyncSupport.php14
-rw-r--r--vendor/sabre/dav/lib/CalDAV/Calendar.php182
-rw-r--r--vendor/sabre/dav/lib/CalDAV/CalendarHome.php164
-rw-r--r--vendor/sabre/dav/lib/CalDAV/CalendarObject.php104
-rw-r--r--vendor/sabre/dav/lib/CalDAV/CalendarQueryValidator.php141
-rw-r--r--vendor/sabre/dav/lib/CalDAV/CalendarRoot.php35
-rw-r--r--vendor/sabre/dav/lib/CalDAV/Exception/InvalidComponentType.php17
-rw-r--r--vendor/sabre/dav/lib/CalDAV/ICSExportPlugin.php154
-rw-r--r--vendor/sabre/dav/lib/CalDAV/ICalendar.php8
-rw-r--r--vendor/sabre/dav/lib/CalDAV/ICalendarObject.php8
-rw-r--r--vendor/sabre/dav/lib/CalDAV/ICalendarObjectContainer.php10
-rw-r--r--vendor/sabre/dav/lib/CalDAV/ISharedCalendar.php9
-rw-r--r--vendor/sabre/dav/lib/CalDAV/Notifications/Collection.php42
-rw-r--r--vendor/sabre/dav/lib/CalDAV/Notifications/ICollection.php6
-rw-r--r--vendor/sabre/dav/lib/CalDAV/Notifications/INode.php11
-rw-r--r--vendor/sabre/dav/lib/CalDAV/Notifications/Node.php59
-rw-r--r--vendor/sabre/dav/lib/CalDAV/Notifications/Plugin.php71
-rw-r--r--vendor/sabre/dav/lib/CalDAV/Plugin.php476
-rw-r--r--vendor/sabre/dav/lib/CalDAV/Principal/Collection.php17
-rw-r--r--vendor/sabre/dav/lib/CalDAV/Principal/IProxyRead.php8
-rw-r--r--vendor/sabre/dav/lib/CalDAV/Principal/IProxyWrite.php8
-rw-r--r--vendor/sabre/dav/lib/CalDAV/Principal/ProxyRead.php95
-rw-r--r--vendor/sabre/dav/lib/CalDAV/Principal/ProxyWrite.php99
-rw-r--r--vendor/sabre/dav/lib/CalDAV/Principal/User.php83
-rw-r--r--vendor/sabre/dav/lib/CalDAV/Schedule/IInbox.php6
-rw-r--r--vendor/sabre/dav/lib/CalDAV/Schedule/IMipPlugin.php84
-rw-r--r--vendor/sabre/dav/lib/CalDAV/Schedule/IOutbox.php6
-rw-r--r--vendor/sabre/dav/lib/CalDAV/Schedule/ISchedulingObject.php8
-rw-r--r--vendor/sabre/dav/lib/CalDAV/Schedule/Inbox.php70
-rw-r--r--vendor/sabre/dav/lib/CalDAV/Schedule/Outbox.php52
-rw-r--r--vendor/sabre/dav/lib/CalDAV/Schedule/Plugin.php463
-rw-r--r--vendor/sabre/dav/lib/CalDAV/Schedule/SchedulingObject.php78
-rw-r--r--vendor/sabre/dav/lib/CalDAV/SharedCalendar.php84
-rw-r--r--vendor/sabre/dav/lib/CalDAV/SharingPlugin.php165
-rw-r--r--vendor/sabre/dav/lib/CalDAV/Subscriptions/ISubscription.php9
-rw-r--r--vendor/sabre/dav/lib/CalDAV/Subscriptions/Plugin.php43
-rw-r--r--vendor/sabre/dav/lib/CalDAV/Subscriptions/Subscription.php86
-rw-r--r--vendor/sabre/dav/lib/CalDAV/Xml/Filter/CalendarData.php23
-rw-r--r--vendor/sabre/dav/lib/CalDAV/Xml/Filter/CompFilter.php43
-rw-r--r--vendor/sabre/dav/lib/CalDAV/Xml/Filter/ParamFilter.php37
-rw-r--r--vendor/sabre/dav/lib/CalDAV/Xml/Filter/PropFilter.php47
-rw-r--r--vendor/sabre/dav/lib/CalDAV/Xml/Notification/Invite.php108
-rw-r--r--vendor/sabre/dav/lib/CalDAV/Xml/Notification/InviteReply.php80
-rw-r--r--vendor/sabre/dav/lib/CalDAV/Xml/Notification/NotificationInterface.php16
-rw-r--r--vendor/sabre/dav/lib/CalDAV/Xml/Notification/SystemStatus.php69
-rw-r--r--vendor/sabre/dav/lib/CalDAV/Xml/Property/AllowedSharingModes.php32
-rw-r--r--vendor/sabre/dav/lib/CalDAV/Xml/Property/EmailAddressSet.php33
-rw-r--r--vendor/sabre/dav/lib/CalDAV/Xml/Property/Invite.php68
-rw-r--r--vendor/sabre/dav/lib/CalDAV/Xml/Property/ScheduleCalendarTransp.php46
-rw-r--r--vendor/sabre/dav/lib/CalDAV/Xml/Property/SupportedCalendarComponentSet.php39
-rw-r--r--vendor/sabre/dav/lib/CalDAV/Xml/Property/SupportedCalendarData.php21
-rw-r--r--vendor/sabre/dav/lib/CalDAV/Xml/Property/SupportedCollationSet.php19
-rw-r--r--vendor/sabre/dav/lib/CalDAV/Xml/Request/CalendarMultiGetReport.php29
-rw-r--r--vendor/sabre/dav/lib/CalDAV/Xml/Request/CalendarQueryReport.php44
-rw-r--r--vendor/sabre/dav/lib/CalDAV/Xml/Request/FreeBusyQueryReport.php33
-rw-r--r--vendor/sabre/dav/lib/CalDAV/Xml/Request/InviteReply.php45
-rw-r--r--vendor/sabre/dav/lib/CalDAV/Xml/Request/MkCalendar.php20
-rw-r--r--vendor/sabre/dav/lib/CalDAV/Xml/Request/Share.php48
66 files changed, 2202 insertions, 2570 deletions
diff --git a/vendor/sabre/dav/lib/CalDAV/Backend/AbstractBackend.php b/vendor/sabre/dav/lib/CalDAV/Backend/AbstractBackend.php
index 311b1c415..336e104c8 100644
--- a/vendor/sabre/dav/lib/CalDAV/Backend/AbstractBackend.php
+++ b/vendor/sabre/dav/lib/CalDAV/Backend/AbstractBackend.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CalDAV\Backend;
use Sabre\CalDAV;
@@ -14,8 +16,8 @@ use Sabre\VObject;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-abstract class AbstractBackend implements BackendInterface {
-
+abstract class AbstractBackend implements BackendInterface
+{
/**
* Updates properties for a calendar.
*
@@ -28,12 +30,11 @@ abstract class AbstractBackend implements BackendInterface {
*
* Read the PropPatch documentation for more info and examples.
*
- * @param mixed $calendarId
+ * @param mixed $calendarId
* @param \Sabre\DAV\PropPatch $propPatch
- * @return void
*/
- function updateCalendar($calendarId, \Sabre\DAV\PropPatch $propPatch) {
-
+ public function updateCalendar($calendarId, \Sabre\DAV\PropPatch $propPatch)
+ {
}
/**
@@ -46,14 +47,14 @@ abstract class AbstractBackend implements BackendInterface {
*
* @param mixed $calendarId
* @param array $uris
+ *
* @return array
*/
- function getMultipleCalendarObjects($calendarId, array $uris) {
-
- return array_map(function($uri) use ($calendarId) {
+ public function getMultipleCalendarObjects($calendarId, array $uris)
+ {
+ return array_map(function ($uri) use ($calendarId) {
return $this->getCalendarObject($calendarId, $uri);
}, $uris);
-
}
/**
@@ -103,23 +104,21 @@ abstract class AbstractBackend implements BackendInterface {
*
* @param mixed $calendarId
* @param array $filters
+ *
* @return array
*/
- function calendarQuery($calendarId, array $filters) {
-
+ public function calendarQuery($calendarId, array $filters)
+ {
$result = [];
$objects = $this->getCalendarObjects($calendarId);
foreach ($objects as $object) {
-
if ($this->validateFilterForObject($object, $filters)) {
$result[] = $object['uri'];
}
-
}
return $result;
-
}
/**
@@ -128,10 +127,11 @@ abstract class AbstractBackend implements BackendInterface {
*
* @param array $object
* @param array $filters
+ *
* @return bool
*/
- protected function validateFilterForObject(array $object, array $filters) {
-
+ protected function validateFilterForObject(array $object, array $filters)
+ {
// Unfortunately, setting the 'calendardata' here is optional. If
// it was excluded, we actually need another call to get this as
// well.
@@ -148,7 +148,6 @@ abstract class AbstractBackend implements BackendInterface {
$vObject->destroy();
return $result;
-
}
/**
@@ -168,14 +167,14 @@ abstract class AbstractBackend implements BackendInterface {
*
* @param string $principalUri
* @param string $uid
+ *
* @return string|null
*/
- function getCalendarObjectByUID($principalUri, $uid) {
-
+ public function getCalendarObjectByUID($principalUri, $uid)
+ {
// Note: this is a super slow naive implementation of this method. You
// are highly recommended to optimize it, if your backend allows it.
foreach ($this->getCalendarsForUser($principalUri) as $calendar) {
-
// We must ignore calendars owned by other principals.
if ($calendar['principaluri'] !== $principalUri) {
continue;
@@ -189,38 +188,35 @@ abstract class AbstractBackend implements BackendInterface {
$results = $this->calendarQuery(
$calendar['id'],
[
- 'name' => 'VCALENDAR',
+ 'name' => 'VCALENDAR',
'prop-filters' => [],
'comp-filters' => [
[
- 'name' => 'VEVENT',
+ 'name' => 'VEVENT',
'is-not-defined' => false,
- 'time-range' => null,
- 'comp-filters' => [],
- 'prop-filters' => [
+ 'time-range' => null,
+ 'comp-filters' => [],
+ 'prop-filters' => [
[
- 'name' => 'UID',
+ 'name' => 'UID',
'is-not-defined' => false,
- 'time-range' => null,
- 'text-match' => [
- 'value' => $uid,
+ 'time-range' => null,
+ 'text-match' => [
+ 'value' => $uid,
'negate-condition' => false,
- 'collation' => 'i;octet',
+ 'collation' => 'i;octet',
],
'param-filters' => [],
],
- ]
- ]
+ ],
+ ],
],
]
);
if ($results) {
// We have a match
- return $calendar['uri'] . '/' . $results[0];
+ return $calendar['uri'].'/'.$results[0];
}
-
}
-
}
-
}
diff --git a/vendor/sabre/dav/lib/CalDAV/Backend/BackendInterface.php b/vendor/sabre/dav/lib/CalDAV/Backend/BackendInterface.php
index bd8ee7602..7d125cf89 100644
--- a/vendor/sabre/dav/lib/CalDAV/Backend/BackendInterface.php
+++ b/vendor/sabre/dav/lib/CalDAV/Backend/BackendInterface.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CalDAV\Backend;
/**
@@ -9,8 +11,8 @@ namespace Sabre\CalDAV\Backend;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-interface BackendInterface {
-
+interface BackendInterface
+{
/**
* Returns a list of calendars for a principal.
*
@@ -34,9 +36,10 @@ interface BackendInterface {
* ACL will automatically be put in read-only mode.
*
* @param string $principalUri
+ *
* @return array
*/
- function getCalendarsForUser($principalUri);
+ public function getCalendarsForUser($principalUri);
/**
* Creates a new calendar for a principal.
@@ -48,10 +51,11 @@ interface BackendInterface {
*
* @param string $principalUri
* @param string $calendarUri
- * @param array $properties
+ * @param array $properties
+ *
* @return mixed
*/
- function createCalendar($principalUri, $calendarUri, array $properties);
+ public function createCalendar($principalUri, $calendarUri, array $properties);
/**
* Updates properties for a calendar.
@@ -65,19 +69,17 @@ interface BackendInterface {
*
* Read the PropPatch documentation for more info and examples.
*
- * @param mixed $calendarId
+ * @param mixed $calendarId
* @param \Sabre\DAV\PropPatch $propPatch
- * @return void
*/
- function updateCalendar($calendarId, \Sabre\DAV\PropPatch $propPatch);
+ public function updateCalendar($calendarId, \Sabre\DAV\PropPatch $propPatch);
/**
- * Delete a calendar and all its objects
+ * Delete a calendar and all its objects.
*
* @param mixed $calendarId
- * @return void
*/
- function deleteCalendar($calendarId);
+ public function deleteCalendar($calendarId);
/**
* Returns all calendar objects within a calendar.
@@ -108,9 +110,10 @@ interface BackendInterface {
* amount of times this is needed is reduced by a great degree.
*
* @param mixed $calendarId
+ *
* @return array
*/
- function getCalendarObjects($calendarId);
+ public function getCalendarObjects($calendarId);
/**
* Returns information from a single calendar object, based on it's object
@@ -124,11 +127,12 @@ interface BackendInterface {
*
* This method must return null if the object did not exist.
*
- * @param mixed $calendarId
+ * @param mixed $calendarId
* @param string $objectUri
+ *
* @return array|null
*/
- function getCalendarObject($calendarId, $objectUri);
+ public function getCalendarObject($calendarId, $objectUri);
/**
* Returns a list of calendar objects.
@@ -140,9 +144,10 @@ interface BackendInterface {
*
* @param mixed $calendarId
* @param array $uris
+ *
* @return array
*/
- function getMultipleCalendarObjects($calendarId, array $uris);
+ public function getMultipleCalendarObjects($calendarId, array $uris);
/**
* Creates a new calendar object.
@@ -157,12 +162,13 @@ interface BackendInterface {
* calendar-data. If the result of a subsequent GET to this object is not
* the exact same as this request body, you should omit the ETag.
*
- * @param mixed $calendarId
+ * @param mixed $calendarId
* @param string $objectUri
* @param string $calendarData
+ *
* @return string|null
*/
- function createCalendarObject($calendarId, $objectUri, $calendarData);
+ public function createCalendarObject($calendarId, $objectUri, $calendarData);
/**
* Updates an existing calendarobject, based on it's uri.
@@ -177,23 +183,23 @@ interface BackendInterface {
* calendar-data. If the result of a subsequent GET to this object is not
* the exact same as this request body, you should omit the ETag.
*
- * @param mixed $calendarId
+ * @param mixed $calendarId
* @param string $objectUri
* @param string $calendarData
+ *
* @return string|null
*/
- function updateCalendarObject($calendarId, $objectUri, $calendarData);
+ public function updateCalendarObject($calendarId, $objectUri, $calendarData);
/**
* Deletes an existing calendar object.
*
* The object uri is only the basename, or filename and not a full path.
*
- * @param mixed $calendarId
+ * @param mixed $calendarId
* @param string $objectUri
- * @return void
*/
- function deleteCalendarObject($calendarId, $objectUri);
+ public function deleteCalendarObject($calendarId, $objectUri);
/**
* Performs a calendar-query on the contents of this calendar.
@@ -242,9 +248,10 @@ interface BackendInterface {
*
* @param mixed $calendarId
* @param array $filters
+ *
* @return array
*/
- function calendarQuery($calendarId, array $filters);
+ public function calendarQuery($calendarId, array $filters);
/**
* Searches through all of a users calendars and calendar objects to find
@@ -263,8 +270,8 @@ interface BackendInterface {
*
* @param string $principalUri
* @param string $uid
+ *
* @return string|null
*/
- function getCalendarObjectByUID($principalUri, $uid);
-
+ public function getCalendarObjectByUID($principalUri, $uid);
}
diff --git a/vendor/sabre/dav/lib/CalDAV/Backend/NotificationSupport.php b/vendor/sabre/dav/lib/CalDAV/Backend/NotificationSupport.php
index bf2ef27a0..0ba493305 100644
--- a/vendor/sabre/dav/lib/CalDAV/Backend/NotificationSupport.php
+++ b/vendor/sabre/dav/lib/CalDAV/Backend/NotificationSupport.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CalDAV\Backend;
use Sabre\CalDAV\Xml\Notification\NotificationInterface;
@@ -22,26 +24,26 @@ use Sabre\CalDAV\Xml\Notification\NotificationInterface;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-interface NotificationSupport extends BackendInterface {
-
+interface NotificationSupport extends BackendInterface
+{
/**
* Returns a list of notifications for a given principal url.
*
* @param string $principalUri
+ *
* @return NotificationInterface[]
*/
- function getNotificationsForPrincipal($principalUri);
+ public function getNotificationsForPrincipal($principalUri);
/**
* This deletes a specific notifcation.
*
* This may be called by a client once it deems a notification handled.
*
- * @param string $principalUri
+ * @param string $principalUri
* @param NotificationInterface $notification
- * @return void
*/
- function deleteNotification($principalUri, NotificationInterface $notification);
+ public function deleteNotification($principalUri, NotificationInterface $notification);
/**
* This method is called when a user replied to a request to share.
@@ -49,13 +51,13 @@ interface NotificationSupport extends BackendInterface {
* If the user chose to accept the share, this method should return the
* newly created calendar url.
*
- * @param string $href The sharee who is replying (often a mailto: address)
- * @param int $status One of the SharingPlugin::STATUS_* constants
+ * @param string $href The sharee who is replying (often a mailto: address)
+ * @param int $status One of the SharingPlugin::STATUS_* constants
* @param string $calendarUri The url to the calendar thats being shared
- * @param string $inReplyTo The unique id this message is a response to
- * @param string $summary A description of the reply
- * @return null|string
+ * @param string $inReplyTo The unique id this message is a response to
+ * @param string $summary A description of the reply
+ *
+ * @return string|null
*/
- function shareReply($href, $status, $calendarUri, $inReplyTo, $summary = null);
-
+ public function shareReply($href, $status, $calendarUri, $inReplyTo, $summary = null);
}
diff --git a/vendor/sabre/dav/lib/CalDAV/Backend/PDO.php b/vendor/sabre/dav/lib/CalDAV/Backend/PDO.php
index 458440588..003dc1392 100644
--- a/vendor/sabre/dav/lib/CalDAV/Backend/PDO.php
+++ b/vendor/sabre/dav/lib/CalDAV/Backend/PDO.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CalDAV\Backend;
use Sabre\CalDAV;
@@ -9,7 +11,7 @@ use Sabre\DAV\Xml\Element\Sharee;
use Sabre\VObject;
/**
- * PDO CalDAV backend
+ * PDO CalDAV backend.
*
* This backend is used to store calendar-data in a PDO database, such as
* sqlite or MySQL
@@ -18,15 +20,10 @@ use Sabre\VObject;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-class PDO extends AbstractBackend
- implements
- SyncSupport,
- SubscriptionSupport,
- SchedulingSupport,
- SharingSupport {
-
+class PDO extends AbstractBackend implements SyncSupport, SubscriptionSupport, SchedulingSupport, SharingSupport
+{
/**
- * We need to specify a max date, because we need to stop *somewhere*
+ * We need to specify a max date, because we need to stop *somewhere*.
*
* On 32 bit system the maximum for a signed integer is 2147483647, so
* MAX_DATE cannot be higher than date('Y-m-d', 2147483647) which results
@@ -36,14 +33,14 @@ class PDO extends AbstractBackend
const MAX_DATE = '2038-01-01';
/**
- * pdo
+ * pdo.
*
* @var \PDO
*/
protected $pdo;
/**
- * The table name that will be used for calendars
+ * The table name that will be used for calendars.
*
* @var string
*/
@@ -60,7 +57,7 @@ class PDO extends AbstractBackend
public $calendarInstancesTableName = 'calendarinstances';
/**
- * The table name that will be used for calendar objects
+ * The table name that will be used for calendar objects.
*
* @var string
*/
@@ -96,11 +93,11 @@ class PDO extends AbstractBackend
* @var array
*/
public $propertyMap = [
- '{DAV:}displayname' => 'displayname',
+ '{DAV:}displayname' => 'displayname',
'{urn:ietf:params:xml:ns:caldav}calendar-description' => 'description',
- '{urn:ietf:params:xml:ns:caldav}calendar-timezone' => 'timezone',
- '{http://apple.com/ns/ical/}calendar-order' => 'calendarorder',
- '{http://apple.com/ns/ical/}calendar-color' => 'calendarcolor',
+ '{urn:ietf:params:xml:ns:caldav}calendar-timezone' => 'timezone',
+ '{http://apple.com/ns/ical/}calendar-order' => 'calendarorder',
+ '{http://apple.com/ns/ical/}calendar-color' => 'calendarcolor',
];
/**
@@ -109,24 +106,23 @@ class PDO extends AbstractBackend
* @var array
*/
public $subscriptionPropertyMap = [
- '{DAV:}displayname' => 'displayname',
- '{http://apple.com/ns/ical/}refreshrate' => 'refreshrate',
- '{http://apple.com/ns/ical/}calendar-order' => 'calendarorder',
- '{http://apple.com/ns/ical/}calendar-color' => 'calendarcolor',
- '{http://calendarserver.org/ns/}subscribed-strip-todos' => 'striptodos',
- '{http://calendarserver.org/ns/}subscribed-strip-alarms' => 'stripalarms',
+ '{DAV:}displayname' => 'displayname',
+ '{http://apple.com/ns/ical/}refreshrate' => 'refreshrate',
+ '{http://apple.com/ns/ical/}calendar-order' => 'calendarorder',
+ '{http://apple.com/ns/ical/}calendar-color' => 'calendarcolor',
+ '{http://calendarserver.org/ns/}subscribed-strip-todos' => 'striptodos',
+ '{http://calendarserver.org/ns/}subscribed-strip-alarms' => 'stripalarms',
'{http://calendarserver.org/ns/}subscribed-strip-attachments' => 'stripattachments',
];
/**
- * Creates the backend
+ * Creates the backend.
*
* @param \PDO $pdo
*/
- function __construct(\PDO $pdo) {
-
+ public function __construct(\PDO $pdo)
+ {
$this->pdo = $pdo;
-
}
/**
@@ -151,10 +147,11 @@ class PDO extends AbstractBackend
* ACL will automatically be put in read-only mode.
*
* @param string $principalUri
+ *
* @return array
*/
- function getCalendarsForUser($principalUri) {
-
+ public function getCalendarsForUser($principalUri)
+ {
$fields = array_values($this->propertyMap);
$fields[] = 'calendarid';
$fields[] = 'uri';
@@ -177,24 +174,23 @@ SQL
$calendars = [];
while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
-
$components = [];
if ($row['components']) {
$components = explode(',', $row['components']);
}
$calendar = [
- 'id' => [(int)$row['calendarid'], (int)$row['id']],
- 'uri' => $row['uri'],
- 'principaluri' => $row['principaluri'],
- '{' . CalDAV\Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken'] ? $row['synctoken'] : '0'),
- '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0',
- '{' . CalDAV\Plugin::NS_CALDAV . '}supported-calendar-component-set' => new CalDAV\Xml\Property\SupportedCalendarComponentSet($components),
- '{' . CalDAV\Plugin::NS_CALDAV . '}schedule-calendar-transp' => new CalDAV\Xml\Property\ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'),
- 'share-resource-uri' => '/ns/share/' . $row['calendarid'],
+ 'id' => [(int) $row['calendarid'], (int) $row['id']],
+ 'uri' => $row['uri'],
+ 'principaluri' => $row['principaluri'],
+ '{'.CalDAV\Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'),
+ '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0',
+ '{'.CalDAV\Plugin::NS_CALDAV.'}supported-calendar-component-set' => new CalDAV\Xml\Property\SupportedCalendarComponentSet($components),
+ '{'.CalDAV\Plugin::NS_CALDAV.'}schedule-calendar-transp' => new CalDAV\Xml\Property\ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'),
+ 'share-resource-uri' => '/ns/share/'.$row['calendarid'],
];
- $calendar['share-access'] = (int)$row['access'];
+ $calendar['share-access'] = (int) $row['access'];
// 1 = owner, 2 = readonly, 3 = readwrite
if ($row['access'] > 1) {
// We need to find more information about the original owner.
@@ -203,7 +199,7 @@ SQL
// read-only is for backwards compatbility. Might go away in
// the future.
- $calendar['read-only'] = (int)$row['access'] === \Sabre\DAV\Sharing\Plugin::ACCESS_READ;
+ $calendar['read-only'] = \Sabre\DAV\Sharing\Plugin::ACCESS_READ === (int) $row['access'];
}
foreach ($this->propertyMap as $xmlName => $dbName) {
@@ -211,11 +207,9 @@ SQL
}
$calendars[] = $calendar;
-
}
return $calendars;
-
}
/**
@@ -226,11 +220,12 @@ SQL
*
* @param string $principalUri
* @param string $calendarUri
- * @param array $properties
+ * @param array $properties
+ *
* @return string
*/
- function createCalendar($principalUri, $calendarUri, array $properties) {
-
+ public function createCalendar($principalUri, $calendarUri, array $properties)
+ {
$fieldNames = [
'principaluri',
'uri',
@@ -239,51 +234,48 @@ SQL
];
$values = [
':principaluri' => $principalUri,
- ':uri' => $calendarUri,
- ':transparent' => 0,
+ ':uri' => $calendarUri,
+ ':transparent' => 0,
];
-
$sccs = '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set';
if (!isset($properties[$sccs])) {
// Default value
$components = 'VEVENT,VTODO';
} else {
if (!($properties[$sccs] instanceof CalDAV\Xml\Property\SupportedCalendarComponentSet)) {
- throw new DAV\Exception('The ' . $sccs . ' property must be of type: \Sabre\CalDAV\Xml\Property\SupportedCalendarComponentSet');
+ throw new DAV\Exception('The '.$sccs.' property must be of type: \Sabre\CalDAV\Xml\Property\SupportedCalendarComponentSet');
}
$components = implode(',', $properties[$sccs]->getValue());
}
- $transp = '{' . CalDAV\Plugin::NS_CALDAV . '}schedule-calendar-transp';
+ $transp = '{'.CalDAV\Plugin::NS_CALDAV.'}schedule-calendar-transp';
if (isset($properties[$transp])) {
- $values[':transparent'] = $properties[$transp]->getValue() === 'transparent' ? 1 : 0;
+ $values[':transparent'] = 'transparent' === $properties[$transp]->getValue() ? 1 : 0;
}
- $stmt = $this->pdo->prepare("INSERT INTO " . $this->calendarTableName . " (synctoken, components) VALUES (1, ?)");
+ $stmt = $this->pdo->prepare('INSERT INTO '.$this->calendarTableName.' (synctoken, components) VALUES (1, ?)');
$stmt->execute([$components]);
$calendarId = $this->pdo->lastInsertId(
- $this->calendarTableName . '_id_seq'
+ $this->calendarTableName.'_id_seq'
);
$values[':calendarid'] = $calendarId;
foreach ($this->propertyMap as $xmlName => $dbName) {
if (isset($properties[$xmlName])) {
-
- $values[':' . $dbName] = $properties[$xmlName];
+ $values[':'.$dbName] = $properties[$xmlName];
$fieldNames[] = $dbName;
}
}
- $stmt = $this->pdo->prepare("INSERT INTO " . $this->calendarInstancesTableName . " (" . implode(', ', $fieldNames) . ") VALUES (" . implode(', ', array_keys($values)) . ")");
+ $stmt = $this->pdo->prepare('INSERT INTO '.$this->calendarInstancesTableName.' ('.implode(', ', $fieldNames).') VALUES ('.implode(', ', array_keys($values)).')');
$stmt->execute($values);
return [
$calendarId,
- $this->pdo->lastInsertId($this->calendarInstancesTableName . '_id_seq')
+ $this->pdo->lastInsertId($this->calendarInstancesTableName.'_id_seq'),
];
-
}
/**
@@ -298,100 +290,88 @@ SQL
*
* Read the PropPatch documentation for more info and examples.
*
- * @param mixed $calendarId
+ * @param mixed $calendarId
* @param \Sabre\DAV\PropPatch $propPatch
- * @return void
*/
- function updateCalendar($calendarId, \Sabre\DAV\PropPatch $propPatch) {
-
+ public function updateCalendar($calendarId, \Sabre\DAV\PropPatch $propPatch)
+ {
if (!is_array($calendarId)) {
throw new \InvalidArgumentException('The value passed to $calendarId is expected to be an array with a calendarId and an instanceId');
}
list($calendarId, $instanceId) = $calendarId;
$supportedProperties = array_keys($this->propertyMap);
- $supportedProperties[] = '{' . CalDAV\Plugin::NS_CALDAV . '}schedule-calendar-transp';
+ $supportedProperties[] = '{'.CalDAV\Plugin::NS_CALDAV.'}schedule-calendar-transp';
- $propPatch->handle($supportedProperties, function($mutations) use ($calendarId, $instanceId) {
+ $propPatch->handle($supportedProperties, function ($mutations) use ($calendarId, $instanceId) {
$newValues = [];
foreach ($mutations as $propertyName => $propertyValue) {
-
switch ($propertyName) {
- case '{' . CalDAV\Plugin::NS_CALDAV . '}schedule-calendar-transp' :
+ case '{'.CalDAV\Plugin::NS_CALDAV.'}schedule-calendar-transp':
$fieldName = 'transparent';
- $newValues[$fieldName] = $propertyValue->getValue() === 'transparent';
+ $newValues[$fieldName] = 'transparent' === $propertyValue->getValue();
break;
- default :
+ default:
$fieldName = $this->propertyMap[$propertyName];
$newValues[$fieldName] = $propertyValue;
break;
}
-
}
$valuesSql = [];
foreach ($newValues as $fieldName => $value) {
- $valuesSql[] = $fieldName . ' = ?';
+ $valuesSql[] = $fieldName.' = ?';
}
- $stmt = $this->pdo->prepare("UPDATE " . $this->calendarInstancesTableName . " SET " . implode(', ', $valuesSql) . " WHERE id = ?");
+ $stmt = $this->pdo->prepare('UPDATE '.$this->calendarInstancesTableName.' SET '.implode(', ', $valuesSql).' WHERE id = ?');
$newValues['id'] = $instanceId;
$stmt->execute(array_values($newValues));
- $this->addChange($calendarId, "", 2);
+ $this->addChange($calendarId, '', 2);
return true;
-
});
-
}
/**
- * Delete a calendar and all it's objects
+ * Delete a calendar and all it's objects.
*
* @param mixed $calendarId
- * @return void
*/
- function deleteCalendar($calendarId) {
-
+ public function deleteCalendar($calendarId)
+ {
if (!is_array($calendarId)) {
throw new \InvalidArgumentException('The value passed to $calendarId is expected to be an array with a calendarId and an instanceId');
}
list($calendarId, $instanceId) = $calendarId;
- $stmt = $this->pdo->prepare('SELECT access FROM ' . $this->calendarInstancesTableName . ' where id = ?');
+ $stmt = $this->pdo->prepare('SELECT access FROM '.$this->calendarInstancesTableName.' where id = ?');
$stmt->execute([$instanceId]);
- $access = (int)$stmt->fetchColumn();
-
- if ($access === \Sabre\DAV\Sharing\Plugin::ACCESS_SHAREDOWNER) {
+ $access = (int) $stmt->fetchColumn();
+ if (\Sabre\DAV\Sharing\Plugin::ACCESS_SHAREDOWNER === $access) {
/**
* If the user is the owner of the calendar, we delete all data and all
* instances.
**/
- $stmt = $this->pdo->prepare('DELETE FROM ' . $this->calendarObjectTableName . ' WHERE calendarid = ?');
+ $stmt = $this->pdo->prepare('DELETE FROM '.$this->calendarObjectTableName.' WHERE calendarid = ?');
$stmt->execute([$calendarId]);
- $stmt = $this->pdo->prepare('DELETE FROM ' . $this->calendarChangesTableName . ' WHERE calendarid = ?');
+ $stmt = $this->pdo->prepare('DELETE FROM '.$this->calendarChangesTableName.' WHERE calendarid = ?');
$stmt->execute([$calendarId]);
- $stmt = $this->pdo->prepare('DELETE FROM ' . $this->calendarInstancesTableName . ' WHERE calendarid = ?');
+ $stmt = $this->pdo->prepare('DELETE FROM '.$this->calendarInstancesTableName.' WHERE calendarid = ?');
$stmt->execute([$calendarId]);
- $stmt = $this->pdo->prepare('DELETE FROM ' . $this->calendarTableName . ' WHERE id = ?');
+ $stmt = $this->pdo->prepare('DELETE FROM '.$this->calendarTableName.' WHERE id = ?');
$stmt->execute([$calendarId]);
-
} else {
-
/**
* If it was an instance of a shared calendar, we only delete that
* instance.
*/
- $stmt = $this->pdo->prepare('DELETE FROM ' . $this->calendarInstancesTableName . ' WHERE id = ?');
+ $stmt = $this->pdo->prepare('DELETE FROM '.$this->calendarInstancesTableName.' WHERE id = ?');
$stmt->execute([$instanceId]);
-
}
-
-
}
/**
@@ -423,32 +403,32 @@ SQL
* amount of times this is needed is reduced by a great degree.
*
* @param mixed $calendarId
+ *
* @return array
*/
- function getCalendarObjects($calendarId) {
-
+ public function getCalendarObjects($calendarId)
+ {
if (!is_array($calendarId)) {
throw new \InvalidArgumentException('The value passed to $calendarId is expected to be an array with a calendarId and an instanceId');
}
list($calendarId, $instanceId) = $calendarId;
- $stmt = $this->pdo->prepare('SELECT id, uri, lastmodified, etag, calendarid, size, componenttype FROM ' . $this->calendarObjectTableName . ' WHERE calendarid = ?');
+ $stmt = $this->pdo->prepare('SELECT id, uri, lastmodified, etag, calendarid, size, componenttype FROM '.$this->calendarObjectTableName.' WHERE calendarid = ?');
$stmt->execute([$calendarId]);
$result = [];
foreach ($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) {
$result[] = [
- 'id' => $row['id'],
- 'uri' => $row['uri'],
- 'lastmodified' => (int)$row['lastmodified'],
- 'etag' => '"' . $row['etag'] . '"',
- 'size' => (int)$row['size'],
- 'component' => strtolower($row['componenttype']),
+ 'id' => $row['id'],
+ 'uri' => $row['uri'],
+ 'lastmodified' => (int) $row['lastmodified'],
+ 'etag' => '"'.$row['etag'].'"',
+ 'size' => (int) $row['size'],
+ 'component' => strtolower($row['componenttype']),
];
}
return $result;
-
}
/**
@@ -463,33 +443,35 @@ SQL
*
* This method must return null if the object did not exist.
*
- * @param mixed $calendarId
+ * @param mixed $calendarId
* @param string $objectUri
+ *
* @return array|null
*/
- function getCalendarObject($calendarId, $objectUri) {
-
+ public function getCalendarObject($calendarId, $objectUri)
+ {
if (!is_array($calendarId)) {
throw new \InvalidArgumentException('The value passed to $calendarId is expected to be an array with a calendarId and an instanceId');
}
list($calendarId, $instanceId) = $calendarId;
- $stmt = $this->pdo->prepare('SELECT id, uri, lastmodified, etag, calendarid, size, calendardata, componenttype FROM ' . $this->calendarObjectTableName . ' WHERE calendarid = ? AND uri = ?');
+ $stmt = $this->pdo->prepare('SELECT id, uri, lastmodified, etag, calendarid, size, calendardata, componenttype FROM '.$this->calendarObjectTableName.' WHERE calendarid = ? AND uri = ?');
$stmt->execute([$calendarId, $objectUri]);
$row = $stmt->fetch(\PDO::FETCH_ASSOC);
- if (!$row) return null;
+ if (!$row) {
+ return null;
+ }
return [
- 'id' => $row['id'],
- 'uri' => $row['uri'],
- 'lastmodified' => (int)$row['lastmodified'],
- 'etag' => '"' . $row['etag'] . '"',
- 'size' => (int)$row['size'],
+ 'id' => $row['id'],
+ 'uri' => $row['uri'],
+ 'lastmodified' => (int) $row['lastmodified'],
+ 'etag' => '"'.$row['etag'].'"',
+ 'size' => (int) $row['size'],
'calendardata' => $row['calendardata'],
- 'component' => strtolower($row['componenttype']),
+ 'component' => strtolower($row['componenttype']),
];
-
}
/**
@@ -502,10 +484,11 @@ SQL
*
* @param mixed $calendarId
* @param array $uris
+ *
* @return array
*/
- function getMultipleCalendarObjects($calendarId, array $uris) {
-
+ public function getMultipleCalendarObjects($calendarId, array $uris)
+ {
if (!is_array($calendarId)) {
throw new \InvalidArgumentException('The value passed to $calendarId is expected to be an array with a calendarId and an instanceId');
}
@@ -513,7 +496,7 @@ SQL
$result = [];
foreach (array_chunk($uris, 900) as $chunk) {
- $query = 'SELECT id, uri, lastmodified, etag, calendarid, size, calendardata, componenttype FROM ' . $this->calendarObjectTableName . ' WHERE calendarid = ? AND uri IN (';
+ $query = 'SELECT id, uri, lastmodified, etag, calendarid, size, calendardata, componenttype FROM '.$this->calendarObjectTableName.' WHERE calendarid = ? AND uri IN (';
// Inserting a whole bunch of question marks
$query .= implode(',', array_fill(0, count($chunk), '?'));
$query .= ')';
@@ -522,24 +505,21 @@ SQL
$stmt->execute(array_merge([$calendarId], $chunk));
while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
-
$result[] = [
- 'id' => $row['id'],
- 'uri' => $row['uri'],
- 'lastmodified' => (int)$row['lastmodified'],
- 'etag' => '"' . $row['etag'] . '"',
- 'size' => (int)$row['size'],
+ 'id' => $row['id'],
+ 'uri' => $row['uri'],
+ 'lastmodified' => (int) $row['lastmodified'],
+ 'etag' => '"'.$row['etag'].'"',
+ 'size' => (int) $row['size'],
'calendardata' => $row['calendardata'],
- 'component' => strtolower($row['componenttype']),
+ 'component' => strtolower($row['componenttype']),
];
-
}
}
- return $result;
+ return $result;
}
-
/**
* Creates a new calendar object.
*
@@ -553,13 +533,14 @@ SQL
* calendar-data. If the result of a subsequent GET to this object is not
* the exact same as this request body, you should omit the ETag.
*
- * @param mixed $calendarId
+ * @param mixed $calendarId
* @param string $objectUri
* @param string $calendarData
+ *
* @return string|null
*/
- function createCalendarObject($calendarId, $objectUri, $calendarData) {
-
+ public function createCalendarObject($calendarId, $objectUri, $calendarData)
+ {
if (!is_array($calendarId)) {
throw new \InvalidArgumentException('The value passed to $calendarId is expected to be an array with a calendarId and an instanceId');
}
@@ -567,7 +548,7 @@ SQL
$extraData = $this->getDenormalizedData($calendarData);
- $stmt = $this->pdo->prepare('INSERT INTO ' . $this->calendarObjectTableName . ' (calendarid, uri, calendardata, lastmodified, etag, size, componenttype, firstoccurence, lastoccurence, uid) VALUES (?,?,?,?,?,?,?,?,?,?)');
+ $stmt = $this->pdo->prepare('INSERT INTO '.$this->calendarObjectTableName.' (calendarid, uri, calendardata, lastmodified, etag, size, componenttype, firstoccurence, lastoccurence, uid) VALUES (?,?,?,?,?,?,?,?,?,?)');
$stmt->execute([
$calendarId,
$objectUri,
@@ -582,8 +563,7 @@ SQL
]);
$this->addChange($calendarId, $objectUri, 1);
- return '"' . $extraData['etag'] . '"';
-
+ return '"'.$extraData['etag'].'"';
}
/**
@@ -599,13 +579,14 @@ SQL
* calendar-data. If the result of a subsequent GET to this object is not
* the exact same as this request body, you should omit the ETag.
*
- * @param mixed $calendarId
+ * @param mixed $calendarId
* @param string $objectUri
* @param string $calendarData
+ *
* @return string|null
*/
- function updateCalendarObject($calendarId, $objectUri, $calendarData) {
-
+ public function updateCalendarObject($calendarId, $objectUri, $calendarData)
+ {
if (!is_array($calendarId)) {
throw new \InvalidArgumentException('The value passed to $calendarId is expected to be an array with a calendarId and an instanceId');
}
@@ -613,13 +594,12 @@ SQL
$extraData = $this->getDenormalizedData($calendarData);
- $stmt = $this->pdo->prepare('UPDATE ' . $this->calendarObjectTableName . ' SET calendardata = ?, lastmodified = ?, etag = ?, size = ?, componenttype = ?, firstoccurence = ?, lastoccurence = ?, uid = ? WHERE calendarid = ? AND uri = ?');
+ $stmt = $this->pdo->prepare('UPDATE '.$this->calendarObjectTableName.' SET calendardata = ?, lastmodified = ?, etag = ?, size = ?, componenttype = ?, firstoccurence = ?, lastoccurence = ?, uid = ? WHERE calendarid = ? AND uri = ?');
$stmt->execute([$calendarData, time(), $extraData['etag'], $extraData['size'], $extraData['componentType'], $extraData['firstOccurence'], $extraData['lastOccurence'], $extraData['uid'], $calendarId, $objectUri]);
$this->addChange($calendarId, $objectUri, 2);
- return '"' . $extraData['etag'] . '"';
-
+ return '"'.$extraData['etag'].'"';
}
/**
@@ -635,10 +615,11 @@ SQL
* * uid - value of the UID property
*
* @param string $calendarData
+ *
* @return array
*/
- protected function getDenormalizedData($calendarData) {
-
+ protected function getDenormalizedData($calendarData)
+ {
$vObject = VObject\Reader::read($calendarData);
$componentType = null;
$component = null;
@@ -646,16 +627,16 @@ SQL
$lastOccurence = null;
$uid = null;
foreach ($vObject->getComponents() as $component) {
- if ($component->name !== 'VTIMEZONE') {
+ if ('VTIMEZONE' !== $component->name) {
$componentType = $component->name;
- $uid = (string)$component->UID;
+ $uid = (string) $component->UID;
break;
}
}
if (!$componentType) {
throw new \Sabre\DAV\Exception\BadRequest('Calendar objects must have a VJOURNAL, VEVENT or VTODO component');
}
- if ($componentType === 'VEVENT') {
+ if ('VEVENT' === $componentType) {
$firstOccurence = $component->DTSTART->getDateTime()->getTimeStamp();
// Finding the last occurence is a bit harder
if (!isset($component->RRULE)) {
@@ -673,7 +654,7 @@ SQL
$lastOccurence = $firstOccurence;
}
} else {
- $it = new VObject\Recur\EventIterator($vObject, (string)$component->UID);
+ $it = new VObject\Recur\EventIterator($vObject, (string) $component->UID);
$maxDate = new \DateTime(self::MAX_DATE);
if ($it->isInfinite()) {
$lastOccurence = $maxDate->getTimeStamp();
@@ -682,30 +663,31 @@ SQL
while ($it->valid() && $end < $maxDate) {
$end = $it->getDtEnd();
$it->next();
-
}
$lastOccurence = $end->getTimeStamp();
}
-
}
// Ensure Occurence values are positive
- if ($firstOccurence < 0) $firstOccurence = 0;
- if ($lastOccurence < 0) $lastOccurence = 0;
+ if ($firstOccurence < 0) {
+ $firstOccurence = 0;
+ }
+ if ($lastOccurence < 0) {
+ $lastOccurence = 0;
+ }
}
// Destroy circular references to PHP will GC the object.
$vObject->destroy();
return [
- 'etag' => md5($calendarData),
- 'size' => strlen($calendarData),
- 'componentType' => $componentType,
+ 'etag' => md5($calendarData),
+ 'size' => strlen($calendarData),
+ 'componentType' => $componentType,
'firstOccurence' => $firstOccurence,
- 'lastOccurence' => $lastOccurence,
- 'uid' => $uid,
+ 'lastOccurence' => $lastOccurence,
+ 'uid' => $uid,
];
-
}
/**
@@ -713,22 +695,20 @@ SQL
*
* The object uri is only the basename, or filename and not a full path.
*
- * @param mixed $calendarId
+ * @param mixed $calendarId
* @param string $objectUri
- * @return void
*/
- function deleteCalendarObject($calendarId, $objectUri) {
-
+ public function deleteCalendarObject($calendarId, $objectUri)
+ {
if (!is_array($calendarId)) {
throw new \InvalidArgumentException('The value passed to $calendarId is expected to be an array with a calendarId and an instanceId');
}
list($calendarId, $instanceId) = $calendarId;
- $stmt = $this->pdo->prepare('DELETE FROM ' . $this->calendarObjectTableName . ' WHERE calendarid = ? AND uri = ?');
+ $stmt = $this->pdo->prepare('DELETE FROM '.$this->calendarObjectTableName.' WHERE calendarid = ? AND uri = ?');
$stmt->execute([$calendarId, $objectUri]);
$this->addChange($calendarId, $objectUri, 3);
-
}
/**
@@ -781,10 +761,11 @@ SQL
*
* @param mixed $calendarId
* @param array $filters
+ *
* @return array
*/
- function calendarQuery($calendarId, array $filters) {
-
+ public function calendarQuery($calendarId, array $filters)
+ {
if (!is_array($calendarId)) {
throw new \InvalidArgumentException('The value passed to $calendarId is expected to be an array with a calendarId and an instanceId');
}
@@ -808,7 +789,7 @@ SQL
$requirePostFilter = false;
}
// There was a time-range filter
- if ($componentType == 'VEVENT' && isset($filters['comp-filters'][0]['time-range'])) {
+ if ('VEVENT' == $componentType && isset($filters['comp-filters'][0]['time-range'])) {
$timeRange = $filters['comp-filters'][0]['time-range'];
// If start time OR the end time is not specified, we can do a
@@ -817,13 +798,12 @@ SQL
$requirePostFilter = false;
}
}
-
}
if ($requirePostFilter) {
- $query = "SELECT uri, calendardata FROM " . $this->calendarObjectTableName . " WHERE calendarid = :calendarid";
+ $query = 'SELECT uri, calendardata FROM '.$this->calendarObjectTableName.' WHERE calendarid = :calendarid';
} else {
- $query = "SELECT uri FROM " . $this->calendarObjectTableName . " WHERE calendarid = :calendarid";
+ $query = 'SELECT uri FROM '.$this->calendarObjectTableName.' WHERE calendarid = :calendarid';
}
$values = [
@@ -831,16 +811,16 @@ SQL
];
if ($componentType) {
- $query .= " AND componenttype = :componenttype";
+ $query .= ' AND componenttype = :componenttype';
$values['componenttype'] = $componentType;
}
if ($timeRange && $timeRange['start']) {
- $query .= " AND lastoccurence > :startdate";
+ $query .= ' AND lastoccurence > :startdate';
$values['startdate'] = $timeRange['start']->getTimeStamp();
}
if ($timeRange && $timeRange['end']) {
- $query .= " AND firstoccurence < :enddate";
+ $query .= ' AND firstoccurence < :enddate';
$values['enddate'] = $timeRange['end']->getTimeStamp();
}
@@ -855,11 +835,9 @@ SQL
}
}
$result[] = $row['uri'];
-
}
return $result;
-
}
/**
@@ -879,10 +857,11 @@ SQL
*
* @param string $principalUri
* @param string $uid
+ *
* @return string|null
*/
- function getCalendarObjectByUID($principalUri, $uid) {
-
+ public function getCalendarObjectByUID($principalUri, $uid)
+ {
$query = <<<SQL
SELECT
calendar_instances.uri AS calendaruri, calendarobjects.uri as objecturi
@@ -901,9 +880,8 @@ SQL;
$stmt->execute([$principalUri, $uid]);
if ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
- return $row['calendaruri'] . '/' . $row['objecturi'];
+ return $row['calendaruri'].'/'.$row['objecturi'];
}
-
}
/**
@@ -956,37 +934,41 @@ SQL;
*
* The limit is 'suggestive'. You are free to ignore it.
*
- * @param mixed $calendarId
+ * @param mixed $calendarId
* @param string $syncToken
- * @param int $syncLevel
- * @param int $limit
+ * @param int $syncLevel
+ * @param int $limit
+ *
* @return array
*/
- function getChangesForCalendar($calendarId, $syncToken, $syncLevel, $limit = null) {
-
+ public function getChangesForCalendar($calendarId, $syncToken, $syncLevel, $limit = null)
+ {
if (!is_array($calendarId)) {
throw new \InvalidArgumentException('The value passed to $calendarId is expected to be an array with a calendarId and an instanceId');
}
list($calendarId, $instanceId) = $calendarId;
// Current synctoken
- $stmt = $this->pdo->prepare('SELECT synctoken FROM ' . $this->calendarTableName . ' WHERE id = ?');
+ $stmt = $this->pdo->prepare('SELECT synctoken FROM '.$this->calendarTableName.' WHERE id = ?');
$stmt->execute([$calendarId]);
$currentToken = $stmt->fetchColumn(0);
- if (is_null($currentToken)) return null;
+ if (is_null($currentToken)) {
+ return null;
+ }
$result = [
'syncToken' => $currentToken,
- 'added' => [],
- 'modified' => [],
- 'deleted' => [],
+ 'added' => [],
+ 'modified' => [],
+ 'deleted' => [],
];
if ($syncToken) {
-
- $query = "SELECT uri, operation FROM " . $this->calendarChangesTableName . " WHERE synctoken >= ? AND synctoken < ? AND calendarid = ? ORDER BY synctoken";
- if ($limit > 0) $query .= " LIMIT " . (int)$limit;
+ $query = 'SELECT uri, operation FROM '.$this->calendarChangesTableName.' WHERE synctoken >= ? AND synctoken < ? AND calendarid = ? ORDER BY synctoken';
+ if ($limit > 0) {
+ $query .= ' LIMIT '.(int) $limit;
+ }
// Fetching all changes
$stmt = $this->pdo->prepare($query);
@@ -997,60 +979,54 @@ SQL;
// This loop ensures that any duplicates are overwritten, only the
// last change on a node is relevant.
while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
-
$changes[$row['uri']] = $row['operation'];
-
}
foreach ($changes as $uri => $operation) {
-
switch ($operation) {
- case 1 :
+ case 1:
$result['added'][] = $uri;
break;
- case 2 :
+ case 2:
$result['modified'][] = $uri;
break;
- case 3 :
+ case 3:
$result['deleted'][] = $uri;
break;
}
-
}
} else {
// No synctoken supplied, this is the initial sync.
- $query = "SELECT uri FROM " . $this->calendarObjectTableName . " WHERE calendarid = ?";
+ $query = 'SELECT uri FROM '.$this->calendarObjectTableName.' WHERE calendarid = ?';
$stmt = $this->pdo->prepare($query);
$stmt->execute([$calendarId]);
$result['added'] = $stmt->fetchAll(\PDO::FETCH_COLUMN);
}
- return $result;
+ return $result;
}
/**
* Adds a change record to the calendarchanges table.
*
- * @param mixed $calendarId
+ * @param mixed $calendarId
* @param string $objectUri
- * @param int $operation 1 = add, 2 = modify, 3 = delete.
- * @return void
+ * @param int $operation 1 = add, 2 = modify, 3 = delete
*/
- protected function addChange($calendarId, $objectUri, $operation) {
-
- $stmt = $this->pdo->prepare('INSERT INTO ' . $this->calendarChangesTableName . ' (uri, synctoken, calendarid, operation) SELECT ?, synctoken, ?, ? FROM ' . $this->calendarTableName . ' WHERE id = ?');
+ protected function addChange($calendarId, $objectUri, $operation)
+ {
+ $stmt = $this->pdo->prepare('INSERT INTO '.$this->calendarChangesTableName.' (uri, synctoken, calendarid, operation) SELECT ?, synctoken, ?, ? FROM '.$this->calendarTableName.' WHERE id = ?');
$stmt->execute([
$objectUri,
$calendarId,
$operation,
- $calendarId
+ $calendarId,
]);
- $stmt = $this->pdo->prepare('UPDATE ' . $this->calendarTableName . ' SET synctoken = synctoken + 1 WHERE id = ?');
+ $stmt = $this->pdo->prepare('UPDATE '.$this->calendarTableName.' SET synctoken = synctoken + 1 WHERE id = ?');
$stmt->execute([
- $calendarId
+ $calendarId,
]);
-
}
/**
@@ -1082,10 +1058,11 @@ SQL;
* default components).
*
* @param string $principalUri
+ *
* @return array
*/
- function getSubscriptionsForUser($principalUri) {
-
+ public function getSubscriptionsForUser($principalUri)
+ {
$fields = array_values($this->subscriptionPropertyMap);
$fields[] = 'id';
$fields[] = 'uri';
@@ -1095,20 +1072,19 @@ SQL;
// Making fields a comma-delimited list
$fields = implode(', ', $fields);
- $stmt = $this->pdo->prepare("SELECT " . $fields . " FROM " . $this->calendarSubscriptionsTableName . " WHERE principaluri = ? ORDER BY calendarorder ASC");
+ $stmt = $this->pdo->prepare('SELECT '.$fields.' FROM '.$this->calendarSubscriptionsTableName.' WHERE principaluri = ? ORDER BY calendarorder ASC');
$stmt->execute([$principalUri]);
$subscriptions = [];
while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
-
$subscription = [
- 'id' => $row['id'],
- 'uri' => $row['uri'],
+ 'id' => $row['id'],
+ 'uri' => $row['uri'],
'principaluri' => $row['principaluri'],
- 'source' => $row['source'],
+ 'source' => $row['source'],
'lastmodified' => $row['lastmodified'],
- '{' . CalDAV\Plugin::NS_CALDAV . '}supported-calendar-component-set' => new CalDAV\Xml\Property\SupportedCalendarComponentSet(['VTODO', 'VEVENT']),
+ '{'.CalDAV\Plugin::NS_CALDAV.'}supported-calendar-component-set' => new CalDAV\Xml\Property\SupportedCalendarComponentSet(['VTODO', 'VEVENT']),
];
foreach ($this->subscriptionPropertyMap as $xmlName => $dbName) {
@@ -1118,11 +1094,9 @@ SQL;
}
$subscriptions[] = $subscription;
-
}
return $subscriptions;
-
}
/**
@@ -1133,11 +1107,12 @@ SQL;
*
* @param string $principalUri
* @param string $uri
- * @param array $properties
+ * @param array $properties
+ *
* @return mixed
*/
- function createSubscription($principalUri, $uri, array $properties) {
-
+ public function createSubscription($principalUri, $uri, array $properties)
+ {
$fieldNames = [
'principaluri',
'uri',
@@ -1151,30 +1126,28 @@ SQL;
$values = [
':principaluri' => $principalUri,
- ':uri' => $uri,
- ':source' => $properties['{http://calendarserver.org/ns/}source']->getHref(),
+ ':uri' => $uri,
+ ':source' => $properties['{http://calendarserver.org/ns/}source']->getHref(),
':lastmodified' => time(),
];
foreach ($this->subscriptionPropertyMap as $xmlName => $dbName) {
if (isset($properties[$xmlName])) {
-
- $values[':' . $dbName] = $properties[$xmlName];
+ $values[':'.$dbName] = $properties[$xmlName];
$fieldNames[] = $dbName;
}
}
- $stmt = $this->pdo->prepare("INSERT INTO " . $this->calendarSubscriptionsTableName . " (" . implode(', ', $fieldNames) . ") VALUES (" . implode(', ', array_keys($values)) . ")");
+ $stmt = $this->pdo->prepare('INSERT INTO '.$this->calendarSubscriptionsTableName.' ('.implode(', ', $fieldNames).') VALUES ('.implode(', ', array_keys($values)).')');
$stmt->execute($values);
return $this->pdo->lastInsertId(
- $this->calendarSubscriptionsTableName . '_id_seq'
+ $this->calendarSubscriptionsTableName.'_id_seq'
);
-
}
/**
- * Updates a subscription
+ * Updates a subscription.
*
* The list of mutations is stored in a Sabre\DAV\PropPatch object.
* To do the actual updates, you must tell this object which properties
@@ -1185,58 +1158,50 @@ SQL;
*
* Read the PropPatch documentation for more info and examples.
*
- * @param mixed $subscriptionId
+ * @param mixed $subscriptionId
* @param \Sabre\DAV\PropPatch $propPatch
- * @return void
*/
- function updateSubscription($subscriptionId, DAV\PropPatch $propPatch) {
-
+ public function updateSubscription($subscriptionId, DAV\PropPatch $propPatch)
+ {
$supportedProperties = array_keys($this->subscriptionPropertyMap);
$supportedProperties[] = '{http://calendarserver.org/ns/}source';
- $propPatch->handle($supportedProperties, function($mutations) use ($subscriptionId) {
-
+ $propPatch->handle($supportedProperties, function ($mutations) use ($subscriptionId) {
$newValues = [];
foreach ($mutations as $propertyName => $propertyValue) {
-
- if ($propertyName === '{http://calendarserver.org/ns/}source') {
+ if ('{http://calendarserver.org/ns/}source' === $propertyName) {
$newValues['source'] = $propertyValue->getHref();
} else {
$fieldName = $this->subscriptionPropertyMap[$propertyName];
$newValues[$fieldName] = $propertyValue;
}
-
}
// Now we're generating the sql query.
$valuesSql = [];
foreach ($newValues as $fieldName => $value) {
- $valuesSql[] = $fieldName . ' = ?';
+ $valuesSql[] = $fieldName.' = ?';
}
- $stmt = $this->pdo->prepare("UPDATE " . $this->calendarSubscriptionsTableName . " SET " . implode(', ', $valuesSql) . ", lastmodified = ? WHERE id = ?");
+ $stmt = $this->pdo->prepare('UPDATE '.$this->calendarSubscriptionsTableName.' SET '.implode(', ', $valuesSql).', lastmodified = ? WHERE id = ?');
$newValues['lastmodified'] = time();
$newValues['id'] = $subscriptionId;
$stmt->execute(array_values($newValues));
return true;
-
});
-
}
/**
- * Deletes a subscription
+ * Deletes a subscription.
*
* @param mixed $subscriptionId
- * @return void
*/
- function deleteSubscription($subscriptionId) {
-
- $stmt = $this->pdo->prepare('DELETE FROM ' . $this->calendarSubscriptionsTableName . ' WHERE id = ?');
+ public function deleteSubscription($subscriptionId)
+ {
+ $stmt = $this->pdo->prepare('DELETE FROM '.$this->calendarSubscriptionsTableName.' WHERE id = ?');
$stmt->execute([$subscriptionId]);
-
}
/**
@@ -1253,24 +1218,26 @@ SQL;
*
* @param string $principalUri
* @param string $objectUri
+ *
* @return array
*/
- function getSchedulingObject($principalUri, $objectUri) {
-
- $stmt = $this->pdo->prepare('SELECT uri, calendardata, lastmodified, etag, size FROM ' . $this->schedulingObjectTableName . ' WHERE principaluri = ? AND uri = ?');
+ public function getSchedulingObject($principalUri, $objectUri)
+ {
+ $stmt = $this->pdo->prepare('SELECT uri, calendardata, lastmodified, etag, size FROM '.$this->schedulingObjectTableName.' WHERE principaluri = ? AND uri = ?');
$stmt->execute([$principalUri, $objectUri]);
$row = $stmt->fetch(\PDO::FETCH_ASSOC);
- if (!$row) return null;
+ if (!$row) {
+ return null;
+ }
return [
- 'uri' => $row['uri'],
+ 'uri' => $row['uri'],
'calendardata' => $row['calendardata'],
'lastmodified' => $row['lastmodified'],
- 'etag' => '"' . $row['etag'] . '"',
- 'size' => (int)$row['size'],
+ 'etag' => '"'.$row['etag'].'"',
+ 'size' => (int) $row['size'],
];
-
}
/**
@@ -1282,40 +1249,38 @@ SQL;
* The main difference is that 'calendardata' is optional.
*
* @param string $principalUri
+ *
* @return array
*/
- function getSchedulingObjects($principalUri) {
-
- $stmt = $this->pdo->prepare('SELECT id, calendardata, uri, lastmodified, etag, size FROM ' . $this->schedulingObjectTableName . ' WHERE principaluri = ?');
+ public function getSchedulingObjects($principalUri)
+ {
+ $stmt = $this->pdo->prepare('SELECT id, calendardata, uri, lastmodified, etag, size FROM '.$this->schedulingObjectTableName.' WHERE principaluri = ?');
$stmt->execute([$principalUri]);
$result = [];
foreach ($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) {
$result[] = [
'calendardata' => $row['calendardata'],
- 'uri' => $row['uri'],
+ 'uri' => $row['uri'],
'lastmodified' => $row['lastmodified'],
- 'etag' => '"' . $row['etag'] . '"',
- 'size' => (int)$row['size'],
+ 'etag' => '"'.$row['etag'].'"',
+ 'size' => (int) $row['size'],
];
}
return $result;
-
}
/**
- * Deletes a scheduling object
+ * Deletes a scheduling object.
*
* @param string $principalUri
* @param string $objectUri
- * @return void
*/
- function deleteSchedulingObject($principalUri, $objectUri) {
-
- $stmt = $this->pdo->prepare('DELETE FROM ' . $this->schedulingObjectTableName . ' WHERE principaluri = ? AND uri = ?');
+ public function deleteSchedulingObject($principalUri, $objectUri)
+ {
+ $stmt = $this->pdo->prepare('DELETE FROM '.$this->schedulingObjectTableName.' WHERE principaluri = ? AND uri = ?');
$stmt->execute([$principalUri, $objectUri]);
-
}
/**
@@ -1324,35 +1289,32 @@ SQL;
* @param string $principalUri
* @param string $objectUri
* @param string $objectData
- * @return void
*/
- function createSchedulingObject($principalUri, $objectUri, $objectData) {
-
- $stmt = $this->pdo->prepare('INSERT INTO ' . $this->schedulingObjectTableName . ' (principaluri, calendardata, uri, lastmodified, etag, size) VALUES (?, ?, ?, ?, ?, ?)');
+ public function createSchedulingObject($principalUri, $objectUri, $objectData)
+ {
+ $stmt = $this->pdo->prepare('INSERT INTO '.$this->schedulingObjectTableName.' (principaluri, calendardata, uri, lastmodified, etag, size) VALUES (?, ?, ?, ?, ?, ?)');
$stmt->execute([$principalUri, $objectData, $objectUri, time(), md5($objectData), strlen($objectData)]);
-
}
/**
* Updates the list of shares.
*
- * @param mixed $calendarId
+ * @param mixed $calendarId
* @param \Sabre\DAV\Xml\Element\Sharee[] $sharees
- * @return void
*/
- function updateInvites($calendarId, array $sharees) {
-
+ public function updateInvites($calendarId, array $sharees)
+ {
if (!is_array($calendarId)) {
throw new \InvalidArgumentException('The value passed to $calendarId is expected to be an array with a calendarId and an instanceId');
}
$currentInvites = $this->getInvites($calendarId);
list($calendarId, $instanceId) = $calendarId;
- $removeStmt = $this->pdo->prepare("DELETE FROM " . $this->calendarInstancesTableName . " WHERE calendarid = ? AND share_href = ? AND access IN (2,3)");
- $updateStmt = $this->pdo->prepare("UPDATE " . $this->calendarInstancesTableName . " SET access = ?, share_displayname = ?, share_invitestatus = ? WHERE calendarid = ? AND share_href = ?");
+ $removeStmt = $this->pdo->prepare('DELETE FROM '.$this->calendarInstancesTableName.' WHERE calendarid = ? AND share_href = ? AND access IN (2,3)');
+ $updateStmt = $this->pdo->prepare('UPDATE '.$this->calendarInstancesTableName.' SET access = ?, share_displayname = ?, share_invitestatus = ? WHERE calendarid = ? AND share_href = ?');
$insertStmt = $this->pdo->prepare('
-INSERT INTO ' . $this->calendarInstancesTableName . '
+INSERT INTO '.$this->calendarInstancesTableName.'
(
calendarid,
principaluri,
@@ -1382,11 +1344,10 @@ INSERT INTO ' . $this->calendarInstancesTableName . '
?,
?,
?
- FROM ' . $this->calendarInstancesTableName . ' WHERE id = ?');
+ FROM '.$this->calendarInstancesTableName.' WHERE id = ?');
foreach ($sharees as $sharee) {
-
- if ($sharee->access === \Sabre\DAV\Sharing\Plugin::ACCESS_NOACCESS) {
+ if (\Sabre\DAV\Sharing\Plugin::ACCESS_NOACCESS === $sharee->access) {
// if access was set no NOACCESS, it means access for an
// existing sharee was removed.
$removeStmt->execute([$calendarId, $sharee->href]);
@@ -1404,7 +1365,6 @@ INSERT INTO ' . $this->calendarInstancesTableName . '
}
foreach ($currentInvites as $oldSharee) {
-
if ($oldSharee->href === $sharee->href) {
// This is an update
$sharee->properties = array_merge(
@@ -1416,11 +1376,10 @@ INSERT INTO ' . $this->calendarInstancesTableName . '
isset($sharee->properties['{DAV:}displayname']) ? $sharee->properties['{DAV:}displayname'] : null,
$sharee->inviteStatus ?: $oldSharee->inviteStatus,
$calendarId,
- $sharee->href
+ $sharee->href,
]);
continue 2;
}
-
}
// If we got here, it means it was a new sharee
$insertStmt->execute([
@@ -1431,11 +1390,9 @@ INSERT INTO ' . $this->calendarInstancesTableName . '
$sharee->href,
isset($sharee->properties['{DAV:}displayname']) ? $sharee->properties['{DAV:}displayname'] : null,
$sharee->inviteStatus ?: \Sabre\DAV\Sharing\Plugin::INVITE_NORESPONSE,
- $instanceId
+ $instanceId,
]);
-
}
-
}
/**
@@ -1451,10 +1408,11 @@ INSERT INTO ' . $this->calendarInstancesTableName . '
* $properties
*
* @param mixed $calendarId
+ *
* @return \Sabre\DAV\Xml\Element\Sharee[]
*/
- function getInvites($calendarId) {
-
+ public function getInvites($calendarId)
+ {
if (!is_array($calendarId)) {
throw new \InvalidArgumentException('The value passed to getInvites() is expected to be an array with a calendarId and an instanceId');
}
@@ -1477,35 +1435,29 @@ SQL;
$result = [];
while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
-
$result[] = new Sharee([
- 'href' => isset($row['share_href']) ? $row['share_href'] : \Sabre\HTTP\encodePath($row['principaluri']),
- 'access' => (int)$row['access'],
+ 'href' => isset($row['share_href']) ? $row['share_href'] : \Sabre\HTTP\encodePath($row['principaluri']),
+ 'access' => (int) $row['access'],
/// Everyone is always immediately accepted, for now.
- 'inviteStatus' => (int)$row['share_invitestatus'],
- 'properties' =>
- !empty($row['share_displayname'])
+ 'inviteStatus' => (int) $row['share_invitestatus'],
+ 'properties' => !empty($row['share_displayname'])
? ['{DAV:}displayname' => $row['share_displayname']]
: [],
'principal' => $row['principaluri'],
]);
-
}
- return $result;
+ return $result;
}
/**
- * Publishes a calendar
+ * Publishes a calendar.
*
* @param mixed $calendarId
- * @param bool $value
- * @return void
+ * @param bool $value
*/
- function setPublishStatus($calendarId, $value) {
-
+ public function setPublishStatus($calendarId, $value)
+ {
throw new DAV\Exception\NotImplemented('Not implemented');
-
}
-
}
diff --git a/vendor/sabre/dav/lib/CalDAV/Backend/SchedulingSupport.php b/vendor/sabre/dav/lib/CalDAV/Backend/SchedulingSupport.php
index 6ec0bf06b..7986d8c33 100644
--- a/vendor/sabre/dav/lib/CalDAV/Backend/SchedulingSupport.php
+++ b/vendor/sabre/dav/lib/CalDAV/Backend/SchedulingSupport.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CalDAV\Backend;
/**
@@ -10,8 +12,8 @@ namespace Sabre\CalDAV\Backend;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-interface SchedulingSupport extends BackendInterface {
-
+interface SchedulingSupport extends BackendInterface
+{
/**
* Returns a single scheduling object for the inbox collection.
*
@@ -26,9 +28,10 @@ interface SchedulingSupport extends BackendInterface {
*
* @param string $principalUri
* @param string $objectUri
+ *
* @return array
*/
- function getSchedulingObject($principalUri, $objectUri);
+ public function getSchedulingObject($principalUri, $objectUri);
/**
* Returns all scheduling objects for the inbox collection.
@@ -39,18 +42,18 @@ interface SchedulingSupport extends BackendInterface {
* The main difference is that 'calendardata' is optional.
*
* @param string $principalUri
+ *
* @return array
*/
- function getSchedulingObjects($principalUri);
+ public function getSchedulingObjects($principalUri);
/**
* Deletes a scheduling object from the inbox collection.
*
* @param string $principalUri
* @param string $objectUri
- * @return void
*/
- function deleteSchedulingObject($principalUri, $objectUri);
+ public function deleteSchedulingObject($principalUri, $objectUri);
/**
* Creates a new scheduling object. This should land in a users' inbox.
@@ -58,8 +61,6 @@ interface SchedulingSupport extends BackendInterface {
* @param string $principalUri
* @param string $objectUri
* @param string $objectData
- * @return void
*/
- function createSchedulingObject($principalUri, $objectUri, $objectData);
-
+ public function createSchedulingObject($principalUri, $objectUri, $objectData);
}
diff --git a/vendor/sabre/dav/lib/CalDAV/Backend/SharingSupport.php b/vendor/sabre/dav/lib/CalDAV/Backend/SharingSupport.php
index 278ec2564..ce6105990 100644
--- a/vendor/sabre/dav/lib/CalDAV/Backend/SharingSupport.php
+++ b/vendor/sabre/dav/lib/CalDAV/Backend/SharingSupport.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CalDAV\Backend;
/**
@@ -20,16 +22,15 @@ namespace Sabre\CalDAV\Backend;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-interface SharingSupport extends BackendInterface {
-
+interface SharingSupport extends BackendInterface
+{
/**
* Updates the list of shares.
*
- * @param mixed $calendarId
+ * @param mixed $calendarId
* @param \Sabre\DAV\Xml\Element\Sharee[] $sharees
- * @return void
*/
- function updateInvites($calendarId, array $sharees);
+ public function updateInvites($calendarId, array $sharees);
/**
* Returns the list of people whom this calendar is shared with.
@@ -44,17 +45,16 @@ interface SharingSupport extends BackendInterface {
* $properties
*
* @param mixed $calendarId
+ *
* @return \Sabre\DAV\Xml\Element\Sharee[]
*/
- function getInvites($calendarId);
+ public function getInvites($calendarId);
/**
- * Publishes a calendar
+ * Publishes a calendar.
*
* @param mixed $calendarId
- * @param bool $value
- * @return void
+ * @param bool $value
*/
- function setPublishStatus($calendarId, $value);
-
+ public function setPublishStatus($calendarId, $value);
}
diff --git a/vendor/sabre/dav/lib/CalDAV/Backend/SimplePDO.php b/vendor/sabre/dav/lib/CalDAV/Backend/SimplePDO.php
index d21f7f916..b6f3c8bef 100644
--- a/vendor/sabre/dav/lib/CalDAV/Backend/SimplePDO.php
+++ b/vendor/sabre/dav/lib/CalDAV/Backend/SimplePDO.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CalDAV\Backend;
use Sabre\CalDAV;
@@ -31,24 +33,23 @@ use Sabre\DAV;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-class SimplePDO extends AbstractBackend {
-
+class SimplePDO extends AbstractBackend
+{
/**
- * pdo
+ * pdo.
*
* @var \PDO
*/
protected $pdo;
/**
- * Creates the backend
+ * Creates the backend.
*
* @param \PDO $pdo
*/
- function __construct(\PDO $pdo) {
-
+ public function __construct(\PDO $pdo)
+ {
$this->pdo = $pdo;
-
}
/**
@@ -73,27 +74,25 @@ class SimplePDO extends AbstractBackend {
* ACL will automatically be put in read-only mode.
*
* @param string $principalUri
+ *
* @return array
*/
- function getCalendarsForUser($principalUri) {
-
+ public function getCalendarsForUser($principalUri)
+ {
// Making fields a comma-delimited list
- $stmt = $this->pdo->prepare("SELECT id, uri FROM simple_calendars WHERE principaluri = ? ORDER BY id ASC");
+ $stmt = $this->pdo->prepare('SELECT id, uri FROM simple_calendars WHERE principaluri = ? ORDER BY id ASC');
$stmt->execute([$principalUri]);
$calendars = [];
while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
-
$calendars[] = [
- 'id' => $row['id'],
- 'uri' => $row['uri'],
+ 'id' => $row['id'],
+ 'uri' => $row['uri'],
'principaluri' => $principalUri,
];
-
}
return $calendars;
-
}
/**
@@ -104,32 +103,30 @@ class SimplePDO extends AbstractBackend {
*
* @param string $principalUri
* @param string $calendarUri
- * @param array $properties
+ * @param array $properties
+ *
* @return string
*/
- function createCalendar($principalUri, $calendarUri, array $properties) {
-
- $stmt = $this->pdo->prepare("INSERT INTO simple_calendars (principaluri, uri) VALUES (?, ?)");
+ public function createCalendar($principalUri, $calendarUri, array $properties)
+ {
+ $stmt = $this->pdo->prepare('INSERT INTO simple_calendars (principaluri, uri) VALUES (?, ?)');
$stmt->execute([$principalUri, $calendarUri]);
return $this->pdo->lastInsertId();
-
}
/**
- * Delete a calendar and all it's objects
+ * Delete a calendar and all it's objects.
*
* @param string $calendarId
- * @return void
*/
- function deleteCalendar($calendarId) {
-
+ public function deleteCalendar($calendarId)
+ {
$stmt = $this->pdo->prepare('DELETE FROM simple_calendarobjects WHERE calendarid = ?');
$stmt->execute([$calendarId]);
$stmt = $this->pdo->prepare('DELETE FROM simple_calendars WHERE id = ?');
$stmt->execute([$calendarId]);
-
}
/**
@@ -161,27 +158,27 @@ class SimplePDO extends AbstractBackend {
* amount of times this is needed is reduced by a great degree.
*
* @param string $calendarId
+ *
* @return array
*/
- function getCalendarObjects($calendarId) {
-
+ public function getCalendarObjects($calendarId)
+ {
$stmt = $this->pdo->prepare('SELECT id, uri, calendardata FROM simple_calendarobjects WHERE calendarid = ?');
$stmt->execute([$calendarId]);
$result = [];
foreach ($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) {
$result[] = [
- 'id' => $row['id'],
- 'uri' => $row['uri'],
- 'etag' => '"' . md5($row['calendardata']) . '"',
- 'calendarid' => $calendarId,
- 'size' => strlen($row['calendardata']),
+ 'id' => $row['id'],
+ 'uri' => $row['uri'],
+ 'etag' => '"'.md5($row['calendardata']).'"',
+ 'calendarid' => $calendarId,
+ 'size' => strlen($row['calendardata']),
'calendardata' => $row['calendardata'],
];
}
return $result;
-
}
/**
@@ -198,25 +195,27 @@ class SimplePDO extends AbstractBackend {
*
* @param string $calendarId
* @param string $objectUri
+ *
* @return array|null
*/
- function getCalendarObject($calendarId, $objectUri) {
-
+ public function getCalendarObject($calendarId, $objectUri)
+ {
$stmt = $this->pdo->prepare('SELECT id, uri, calendardata FROM simple_calendarobjects WHERE calendarid = ? AND uri = ?');
$stmt->execute([$calendarId, $objectUri]);
$row = $stmt->fetch(\PDO::FETCH_ASSOC);
- if (!$row) return null;
+ if (!$row) {
+ return null;
+ }
return [
- 'id' => $row['id'],
- 'uri' => $row['uri'],
- 'etag' => '"' . md5($row['calendardata']) . '"',
- 'calendarid' => $calendarId,
- 'size' => strlen($row['calendardata']),
+ 'id' => $row['id'],
+ 'uri' => $row['uri'],
+ 'etag' => '"'.md5($row['calendardata']).'"',
+ 'calendarid' => $calendarId,
+ 'size' => strlen($row['calendardata']),
'calendardata' => $row['calendardata'],
];
-
}
/**
@@ -232,22 +231,22 @@ class SimplePDO extends AbstractBackend {
* calendar-data. If the result of a subsequent GET to this object is not
* the exact same as this request body, you should omit the ETag.
*
- * @param mixed $calendarId
+ * @param mixed $calendarId
* @param string $objectUri
* @param string $calendarData
+ *
* @return string|null
*/
- function createCalendarObject($calendarId, $objectUri, $calendarData) {
-
+ public function createCalendarObject($calendarId, $objectUri, $calendarData)
+ {
$stmt = $this->pdo->prepare('INSERT INTO simple_calendarobjects (calendarid, uri, calendardata) VALUES (?,?,?)');
$stmt->execute([
$calendarId,
$objectUri,
- $calendarData
+ $calendarData,
]);
- return '"' . md5($calendarData) . '"';
-
+ return '"'.md5($calendarData).'"';
}
/**
@@ -263,18 +262,18 @@ class SimplePDO extends AbstractBackend {
* calendar-data. If the result of a subsequent GET to this object is not
* the exact same as this request body, you should omit the ETag.
*
- * @param mixed $calendarId
+ * @param mixed $calendarId
* @param string $objectUri
* @param string $calendarData
+ *
* @return string|null
*/
- function updateCalendarObject($calendarId, $objectUri, $calendarData) {
-
+ public function updateCalendarObject($calendarId, $objectUri, $calendarData)
+ {
$stmt = $this->pdo->prepare('UPDATE simple_calendarobjects SET calendardata = ? WHERE calendarid = ? AND uri = ?');
$stmt->execute([$calendarData, $calendarId, $objectUri]);
- return '"' . md5($calendarData) . '"';
-
+ return '"'.md5($calendarData).'"';
}
/**
@@ -284,13 +283,10 @@ class SimplePDO extends AbstractBackend {
*
* @param string $calendarId
* @param string $objectUri
- * @return void
*/
- function deleteCalendarObject($calendarId, $objectUri) {
-
+ public function deleteCalendarObject($calendarId, $objectUri)
+ {
$stmt = $this->pdo->prepare('DELETE FROM simple_calendarobjects WHERE calendarid = ? AND uri = ?');
$stmt->execute([$calendarId, $objectUri]);
-
}
-
}
diff --git a/vendor/sabre/dav/lib/CalDAV/Backend/SubscriptionSupport.php b/vendor/sabre/dav/lib/CalDAV/Backend/SubscriptionSupport.php
index d77a2fe0f..2aaf95cdb 100644
--- a/vendor/sabre/dav/lib/CalDAV/Backend/SubscriptionSupport.php
+++ b/vendor/sabre/dav/lib/CalDAV/Backend/SubscriptionSupport.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CalDAV\Backend;
use Sabre\DAV;
@@ -11,8 +13,8 @@ use Sabre\DAV;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-interface SubscriptionSupport extends BackendInterface {
-
+interface SubscriptionSupport extends BackendInterface
+{
/**
* Returns a list of subscriptions for a principal.
*
@@ -43,9 +45,10 @@ interface SubscriptionSupport extends BackendInterface {
* default components).
*
* @param string $principalUri
+ *
* @return array
*/
- function getSubscriptionsForUser($principalUri);
+ public function getSubscriptionsForUser($principalUri);
/**
* Creates a new subscription for a principal.
@@ -55,13 +58,14 @@ interface SubscriptionSupport extends BackendInterface {
*
* @param string $principalUri
* @param string $uri
- * @param array $properties
+ * @param array $properties
+ *
* @return mixed
*/
- function createSubscription($principalUri, $uri, array $properties);
+ public function createSubscription($principalUri, $uri, array $properties);
/**
- * Updates a subscription
+ * Updates a subscription.
*
* The list of mutations is stored in a Sabre\DAV\PropPatch object.
* To do the actual updates, you must tell this object which properties
@@ -72,18 +76,15 @@ interface SubscriptionSupport extends BackendInterface {
*
* Read the PropPatch documentation for more info and examples.
*
- * @param mixed $subscriptionId
+ * @param mixed $subscriptionId
* @param \Sabre\DAV\PropPatch $propPatch
- * @return void
*/
- function updateSubscription($subscriptionId, DAV\PropPatch $propPatch);
+ public function updateSubscription($subscriptionId, DAV\PropPatch $propPatch);
/**
* Deletes a subscription.
*
* @param mixed $subscriptionId
- * @return void
*/
- function deleteSubscription($subscriptionId);
-
+ public function deleteSubscription($subscriptionId);
}
diff --git a/vendor/sabre/dav/lib/CalDAV/Backend/SyncSupport.php b/vendor/sabre/dav/lib/CalDAV/Backend/SyncSupport.php
index a934505f9..c7f67d176 100644
--- a/vendor/sabre/dav/lib/CalDAV/Backend/SyncSupport.php
+++ b/vendor/sabre/dav/lib/CalDAV/Backend/SyncSupport.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CalDAV\Backend;
/**
@@ -18,8 +20,8 @@ namespace Sabre\CalDAV\Backend;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-interface SyncSupport extends BackendInterface {
-
+interface SyncSupport extends BackendInterface
+{
/**
* The getChanges method returns all the changes that have happened, since
* the specified syncToken in the specified calendar.
@@ -72,10 +74,10 @@ interface SyncSupport extends BackendInterface {
*
* @param string $calendarId
* @param string $syncToken
- * @param int $syncLevel
- * @param int $limit
+ * @param int $syncLevel
+ * @param int $limit
+ *
* @return array
*/
- function getChangesForCalendar($calendarId, $syncToken, $syncLevel, $limit = null);
-
+ public function getChangesForCalendar($calendarId, $syncToken, $syncLevel, $limit = null);
}
diff --git a/vendor/sabre/dav/lib/CalDAV/Calendar.php b/vendor/sabre/dav/lib/CalDAV/Calendar.php
index 7467900cc..717f04f94 100644
--- a/vendor/sabre/dav/lib/CalDAV/Calendar.php
+++ b/vendor/sabre/dav/lib/CalDAV/Calendar.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CalDAV;
use Sabre\DAV;
@@ -16,46 +18,44 @@ use Sabre\DAVACL;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-class Calendar implements ICalendar, DAV\IProperties, DAV\Sync\ISyncCollection, DAV\IMultiGet {
-
+class Calendar implements ICalendar, DAV\IProperties, DAV\Sync\ISyncCollection, DAV\IMultiGet
+{
use DAVACL\ACLTrait;
/**
- * This is an array with calendar information
+ * This is an array with calendar information.
*
* @var array
*/
protected $calendarInfo;
/**
- * CalDAV backend
+ * CalDAV backend.
*
* @var Backend\BackendInterface
*/
protected $caldavBackend;
/**
- * Constructor
+ * Constructor.
*
* @param Backend\BackendInterface $caldavBackend
- * @param array $calendarInfo
+ * @param array $calendarInfo
*/
- function __construct(Backend\BackendInterface $caldavBackend, $calendarInfo) {
-
+ public function __construct(Backend\BackendInterface $caldavBackend, $calendarInfo)
+ {
$this->caldavBackend = $caldavBackend;
$this->calendarInfo = $calendarInfo;
-
}
/**
- * Returns the name of the calendar
+ * Returns the name of the calendar.
*
* @return string
*/
- function getName() {
-
+ public function getName()
+ {
return $this->calendarInfo['uri'];
-
}
/**
@@ -68,69 +68,68 @@ class Calendar implements ICalendar, DAV\IProperties, DAV\Sync\ISyncCollection,
* Read the PropPatch documentation for more information.
*
* @param PropPatch $propPatch
- * @return void
*/
- function propPatch(PropPatch $propPatch) {
-
+ public function propPatch(PropPatch $propPatch)
+ {
return $this->caldavBackend->updateCalendar($this->calendarInfo['id'], $propPatch);
-
}
/**
- * Returns the list of properties
+ * Returns the list of properties.
*
* @param array $requestedProperties
+ *
* @return array
*/
- function getProperties($requestedProperties) {
-
+ public function getProperties($requestedProperties)
+ {
$response = [];
foreach ($this->calendarInfo as $propName => $propValue) {
-
- if (!is_null($propValue) && $propName[0] === '{')
+ if (!is_null($propValue) && '{' === $propName[0]) {
$response[$propName] = $this->calendarInfo[$propName];
-
+ }
}
- return $response;
+ return $response;
}
/**
- * Returns a calendar object
+ * Returns a calendar object.
*
* The contained calendar objects are for example Events or Todo's.
*
* @param string $name
+ *
* @return \Sabre\CalDAV\ICalendarObject
*/
- function getChild($name) {
-
+ public function getChild($name)
+ {
$obj = $this->caldavBackend->getCalendarObject($this->calendarInfo['id'], $name);
- if (!$obj) throw new DAV\Exception\NotFound('Calendar object not found');
-
+ if (!$obj) {
+ throw new DAV\Exception\NotFound('Calendar object not found');
+ }
$obj['acl'] = $this->getChildACL();
return new CalendarObject($this->caldavBackend, $this->calendarInfo, $obj);
-
}
/**
- * Returns the full list of calendar objects
+ * Returns the full list of calendar objects.
*
* @return array
*/
- function getChildren() {
-
+ public function getChildren()
+ {
$objs = $this->caldavBackend->getCalendarObjects($this->calendarInfo['id']);
$children = [];
foreach ($objs as $obj) {
$obj['acl'] = $this->getChildACL();
$children[] = new CalendarObject($this->caldavBackend, $this->calendarInfo, $obj);
}
- return $children;
+ return $children;
}
/**
@@ -140,77 +139,75 @@ class Calendar implements ICalendar, DAV\IProperties, DAV\Sync\ISyncCollection,
* If any children are not found, you do not have to return them.
*
* @param string[] $paths
+ *
* @return array
*/
- function getMultipleChildren(array $paths) {
-
+ public function getMultipleChildren(array $paths)
+ {
$objs = $this->caldavBackend->getMultipleCalendarObjects($this->calendarInfo['id'], $paths);
$children = [];
foreach ($objs as $obj) {
$obj['acl'] = $this->getChildACL();
$children[] = new CalendarObject($this->caldavBackend, $this->calendarInfo, $obj);
}
- return $children;
+ return $children;
}
/**
* Checks if a child-node exists.
*
* @param string $name
+ *
* @return bool
*/
- function childExists($name) {
-
+ public function childExists($name)
+ {
$obj = $this->caldavBackend->getCalendarObject($this->calendarInfo['id'], $name);
- if (!$obj)
+ if (!$obj) {
return false;
- else
+ } else {
return true;
-
+ }
}
/**
- * Creates a new directory
+ * Creates a new directory.
*
* We actually block this, as subdirectories are not allowed in calendars.
*
* @param string $name
- * @return void
*/
- function createDirectory($name) {
-
+ public function createDirectory($name)
+ {
throw new DAV\Exception\MethodNotAllowed('Creating collections in calendar objects is not allowed');
-
}
/**
- * Creates a new file
+ * Creates a new file.
*
* The contents of the new file must be a valid ICalendar string.
*
- * @param string $name
+ * @param string $name
* @param resource $calendarData
+ *
* @return string|null
*/
- function createFile($name, $calendarData = null) {
-
+ public function createFile($name, $calendarData = null)
+ {
if (is_resource($calendarData)) {
$calendarData = stream_get_contents($calendarData);
}
- return $this->caldavBackend->createCalendarObject($this->calendarInfo['id'], $name, $calendarData);
+ return $this->caldavBackend->createCalendarObject($this->calendarInfo['id'], $name, $calendarData);
}
/**
* Deletes the calendar.
- *
- * @return void
*/
- function delete() {
-
+ public function delete()
+ {
$this->caldavBackend->deleteCalendar($this->calendarInfo['id']);
-
}
/**
@@ -218,36 +215,30 @@ class Calendar implements ICalendar, DAV\IProperties, DAV\Sync\ISyncCollection,
* {DAV:}displayname to display a name to display a name.
*
* @param string $newName
- * @return void
*/
- function setName($newName) {
-
+ public function setName($newName)
+ {
throw new DAV\Exception\MethodNotAllowed('Renaming calendars is not yet supported');
-
}
/**
* Returns the last modification date as a unix timestamp.
- *
- * @return null
*/
- function getLastModified() {
-
+ public function getLastModified()
+ {
return null;
-
}
/**
- * Returns the owner principal
+ * Returns the owner principal.
*
* This must be a url to a principal, or null if there's no owner
*
* @return string|null
*/
- function getOwner() {
-
+ public function getOwner()
+ {
return $this->calendarInfo['principaluri'];
-
}
/**
@@ -262,8 +253,8 @@ class Calendar implements ICalendar, DAV\IProperties, DAV\Sync\ISyncCollection,
*
* @return array
*/
- function getACL() {
-
+ public function getACL()
+ {
$acl = [
[
'privilege' => '{DAV:}read',
@@ -272,20 +263,19 @@ class Calendar implements ICalendar, DAV\IProperties, DAV\Sync\ISyncCollection,
],
[
'privilege' => '{DAV:}read',
- 'principal' => $this->getOwner() . '/calendar-proxy-write',
+ 'principal' => $this->getOwner().'/calendar-proxy-write',
'protected' => true,
],
[
'privilege' => '{DAV:}read',
- 'principal' => $this->getOwner() . '/calendar-proxy-read',
+ 'principal' => $this->getOwner().'/calendar-proxy-read',
'protected' => true,
],
[
- 'privilege' => '{' . Plugin::NS_CALDAV . '}read-free-busy',
+ 'privilege' => '{'.Plugin::NS_CALDAV.'}read-free-busy',
'principal' => '{DAV:}authenticated',
'protected' => true,
],
-
];
if (empty($this->calendarInfo['{http://sabredav.org/ns}read-only'])) {
$acl[] = [
@@ -295,13 +285,12 @@ class Calendar implements ICalendar, DAV\IProperties, DAV\Sync\ISyncCollection,
];
$acl[] = [
'privilege' => '{DAV:}write',
- 'principal' => $this->getOwner() . '/calendar-proxy-write',
+ 'principal' => $this->getOwner().'/calendar-proxy-write',
'protected' => true,
];
}
return $acl;
-
}
/**
@@ -311,8 +300,8 @@ class Calendar implements ICalendar, DAV\IProperties, DAV\Sync\ISyncCollection,
*
* @return array
*/
- function getChildACL() {
-
+ public function getChildACL()
+ {
$acl = [
[
'privilege' => '{DAV:}read',
@@ -322,15 +311,14 @@ class Calendar implements ICalendar, DAV\IProperties, DAV\Sync\ISyncCollection,
[
'privilege' => '{DAV:}read',
- 'principal' => $this->getOwner() . '/calendar-proxy-write',
+ 'principal' => $this->getOwner().'/calendar-proxy-write',
'protected' => true,
],
[
'privilege' => '{DAV:}read',
- 'principal' => $this->getOwner() . '/calendar-proxy-read',
+ 'principal' => $this->getOwner().'/calendar-proxy-read',
'protected' => true,
],
-
];
if (empty($this->calendarInfo['{http://sabredav.org/ns}read-only'])) {
$acl[] = [
@@ -340,16 +328,14 @@ class Calendar implements ICalendar, DAV\IProperties, DAV\Sync\ISyncCollection,
];
$acl[] = [
'privilege' => '{DAV:}write',
- 'principal' => $this->getOwner() . '/calendar-proxy-write',
+ 'principal' => $this->getOwner().'/calendar-proxy-write',
'protected' => true,
];
-
}
- return $acl;
+ return $acl;
}
-
/**
* Performs a calendar-query on the contents of this calendar.
*
@@ -365,12 +351,12 @@ class Calendar implements ICalendar, DAV\IProperties, DAV\Sync\ISyncCollection,
* documented by Sabre\CalDAV\CalendarQueryParser.
*
* @param array $filters
+ *
* @return array
*/
- function calendarQuery(array $filters) {
-
+ public function calendarQuery(array $filters)
+ {
return $this->caldavBackend->calendarQuery($this->calendarInfo['id'], $filters);
-
}
/**
@@ -382,8 +368,8 @@ class Calendar implements ICalendar, DAV\IProperties, DAV\Sync\ISyncCollection,
*
* @return string|null
*/
- function getSyncToken() {
-
+ public function getSyncToken()
+ {
if (
$this->caldavBackend instanceof Backend\SyncSupport &&
isset($this->calendarInfo['{DAV:}sync-token'])
@@ -396,7 +382,6 @@ class Calendar implements ICalendar, DAV\IProperties, DAV\Sync\ISyncCollection,
) {
return $this->calendarInfo['{http://sabredav.org/ns}sync-token'];
}
-
}
/**
@@ -450,12 +435,13 @@ class Calendar implements ICalendar, DAV\IProperties, DAV\Sync\ISyncCollection,
* The limit is 'suggestive'. You are free to ignore it.
*
* @param string $syncToken
- * @param int $syncLevel
- * @param int $limit
+ * @param int $syncLevel
+ * @param int $limit
+ *
* @return array
*/
- function getChanges($syncToken, $syncLevel, $limit = null) {
-
+ public function getChanges($syncToken, $syncLevel, $limit = null)
+ {
if (!$this->caldavBackend instanceof Backend\SyncSupport) {
return null;
}
@@ -466,7 +452,5 @@ class Calendar implements ICalendar, DAV\IProperties, DAV\Sync\ISyncCollection,
$syncLevel,
$limit
);
-
}
-
}
diff --git a/vendor/sabre/dav/lib/CalDAV/CalendarHome.php b/vendor/sabre/dav/lib/CalDAV/CalendarHome.php
index ffd7f72fb..663d449bf 100644
--- a/vendor/sabre/dav/lib/CalDAV/CalendarHome.php
+++ b/vendor/sabre/dav/lib/CalDAV/CalendarHome.php
@@ -1,12 +1,14 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CalDAV;
use Sabre\DAV;
use Sabre\DAV\Exception\NotFound;
use Sabre\DAV\MkCol;
use Sabre\DAVACL;
-use Sabre\HTTP\URLUtil;
+use Sabre\Uri;
/**
* The CalendarHome represents a node that is usually in a users'
@@ -20,81 +22,74 @@ use Sabre\HTTP\URLUtil;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-class CalendarHome implements DAV\IExtendedCollection, DAVACL\IACL {
-
+class CalendarHome implements DAV\IExtendedCollection, DAVACL\IACL
+{
use DAVACL\ACLTrait;
/**
- * CalDAV backend
+ * CalDAV backend.
*
* @var Backend\BackendInterface
*/
protected $caldavBackend;
/**
- * Principal information
+ * Principal information.
*
* @var array
*/
protected $principalInfo;
/**
- * Constructor
+ * Constructor.
*
* @param Backend\BackendInterface $caldavBackend
- * @param array $principalInfo
+ * @param array $principalInfo
*/
- function __construct(Backend\BackendInterface $caldavBackend, $principalInfo) {
-
+ public function __construct(Backend\BackendInterface $caldavBackend, $principalInfo)
+ {
$this->caldavBackend = $caldavBackend;
$this->principalInfo = $principalInfo;
-
}
/**
- * Returns the name of this object
+ * Returns the name of this object.
*
* @return string
*/
- function getName() {
+ public function getName()
+ {
+ list(, $name) = Uri\split($this->principalInfo['uri']);
- list(, $name) = URLUtil::splitPath($this->principalInfo['uri']);
return $name;
-
}
/**
- * Updates the name of this object
+ * Updates the name of this object.
*
* @param string $name
- * @return void
*/
- function setName($name) {
-
+ public function setName($name)
+ {
throw new DAV\Exception\Forbidden();
-
}
/**
- * Deletes this object
- *
- * @return void
+ * Deletes this object.
*/
- function delete() {
-
+ public function delete()
+ {
throw new DAV\Exception\Forbidden();
-
}
/**
- * Returns the last modification date
+ * Returns the last modification date.
*
* @return int
*/
- function getLastModified() {
-
+ public function getLastModified()
+ {
return null;
-
}
/**
@@ -102,14 +97,12 @@ class CalendarHome implements DAV\IExtendedCollection, DAVACL\IACL {
*
* This is currently not allowed
*
- * @param string $filename
+ * @param string $filename
* @param resource $data
- * @return void
*/
- function createFile($filename, $data = null) {
-
+ public function createFile($filename, $data = null)
+ {
throw new DAV\Exception\MethodNotAllowed('Creating new files in this collection is not supported');
-
}
/**
@@ -118,30 +111,29 @@ class CalendarHome implements DAV\IExtendedCollection, DAVACL\IACL {
* This is currently not allowed.
*
* @param string $filename
- * @return void
*/
- function createDirectory($filename) {
-
+ public function createDirectory($filename)
+ {
throw new DAV\Exception\MethodNotAllowed('Creating new collections in this collection is not supported');
-
}
/**
- * Returns a single calendar, by name
+ * Returns a single calendar, by name.
*
* @param string $name
+ *
* @return Calendar
*/
- function getChild($name) {
-
+ public function getChild($name)
+ {
// Special nodes
- if ($name === 'inbox' && $this->caldavBackend instanceof Backend\SchedulingSupport) {
+ if ('inbox' === $name && $this->caldavBackend instanceof Backend\SchedulingSupport) {
return new Schedule\Inbox($this->caldavBackend, $this->principalInfo['uri']);
}
- if ($name === 'outbox' && $this->caldavBackend instanceof Backend\SchedulingSupport) {
+ if ('outbox' === $name && $this->caldavBackend instanceof Backend\SchedulingSupport) {
return new Schedule\Outbox($this->principalInfo['uri']);
}
- if ($name === 'notifications' && $this->caldavBackend instanceof Backend\NotificationSupport) {
+ if ('notifications' === $name && $this->caldavBackend instanceof Backend\NotificationSupport) {
return new Notifications\Collection($this->caldavBackend, $this->principalInfo['uri']);
}
@@ -162,36 +154,34 @@ class CalendarHome implements DAV\IExtendedCollection, DAVACL\IACL {
return new Subscriptions\Subscription($this->caldavBackend, $subscription);
}
}
-
}
- throw new NotFound('Node with name \'' . $name . '\' could not be found');
-
+ throw new NotFound('Node with name \''.$name.'\' could not be found');
}
/**
* Checks if a calendar exists.
*
* @param string $name
+ *
* @return bool
*/
- function childExists($name) {
-
+ public function childExists($name)
+ {
try {
- return !!$this->getChild($name);
+ return (bool) $this->getChild($name);
} catch (NotFound $e) {
return false;
}
-
}
/**
- * Returns a list of calendars
+ * Returns a list of calendars.
*
* @return array
*/
- function getChildren() {
-
+ public function getChildren()
+ {
$calendars = $this->caldavBackend->getCalendarsForUser($this->principalInfo['uri']);
$objs = [];
foreach ($calendars as $calendar) {
@@ -220,35 +210,34 @@ class CalendarHome implements DAV\IExtendedCollection, DAVACL\IACL {
}
return $objs;
-
}
/**
* Creates a new calendar or subscription.
*
* @param string $name
- * @param MkCol $mkCol
+ * @param MkCol $mkCol
+ *
* @throws DAV\Exception\InvalidResourceType
- * @return void
*/
- function createExtendedCollection($name, MkCol $mkCol) {
-
+ public function createExtendedCollection($name, MkCol $mkCol)
+ {
$isCalendar = false;
$isSubscription = false;
foreach ($mkCol->getResourceType() as $rt) {
switch ($rt) {
- case '{DAV:}collection' :
- case '{http://calendarserver.org/ns/}shared-owner' :
+ case '{DAV:}collection':
+ case '{http://calendarserver.org/ns/}shared-owner':
// ignore
break;
- case '{urn:ietf:params:xml:ns:caldav}calendar' :
+ case '{urn:ietf:params:xml:ns:caldav}calendar':
$isCalendar = true;
break;
- case '{http://calendarserver.org/ns/}subscribed' :
+ case '{http://calendarserver.org/ns/}subscribed':
$isSubscription = true;
break;
- default :
- throw new DAV\Exception\InvalidResourceType('Unknown resourceType: ' . $rt);
+ default:
+ throw new DAV\Exception\InvalidResourceType('Unknown resourceType: '.$rt);
}
}
@@ -260,15 +249,11 @@ class CalendarHome implements DAV\IExtendedCollection, DAVACL\IACL {
throw new DAV\Exception\InvalidResourceType('This backend does not support subscriptions');
}
$this->caldavBackend->createSubscription($this->principalInfo['uri'], $name, $properties);
-
} elseif ($isCalendar) {
$this->caldavBackend->createCalendar($this->principalInfo['uri'], $name, $properties);
-
} else {
throw new DAV\Exception\InvalidResourceType('You can only create calendars and subscriptions in this collection');
-
}
-
}
/**
@@ -276,10 +261,9 @@ class CalendarHome implements DAV\IExtendedCollection, DAVACL\IACL {
*
* @return string
*/
- function getOwner() {
-
+ public function getOwner()
+ {
return $this->principalInfo['uri'];
-
}
/**
@@ -294,8 +278,8 @@ class CalendarHome implements DAV\IExtendedCollection, DAVACL\IACL {
*
* @return array
*/
- function getACL() {
-
+ public function getACL()
+ {
return [
[
'privilege' => '{DAV:}read',
@@ -309,46 +293,43 @@ class CalendarHome implements DAV\IExtendedCollection, DAVACL\IACL {
],
[
'privilege' => '{DAV:}read',
- 'principal' => $this->principalInfo['uri'] . '/calendar-proxy-write',
+ 'principal' => $this->principalInfo['uri'].'/calendar-proxy-write',
'protected' => true,
],
[
'privilege' => '{DAV:}write',
- 'principal' => $this->principalInfo['uri'] . '/calendar-proxy-write',
+ 'principal' => $this->principalInfo['uri'].'/calendar-proxy-write',
'protected' => true,
],
[
'privilege' => '{DAV:}read',
- 'principal' => $this->principalInfo['uri'] . '/calendar-proxy-read',
+ 'principal' => $this->principalInfo['uri'].'/calendar-proxy-read',
'protected' => true,
],
-
];
-
}
-
/**
* This method is called when a user replied to a request to share.
*
* This method should return the url of the newly created calendar if the
* share was accepted.
*
- * @param string $href The sharee who is replying (often a mailto: address)
- * @param int $status One of the SharingPlugin::STATUS_* constants
+ * @param string $href The sharee who is replying (often a mailto: address)
+ * @param int $status One of the SharingPlugin::STATUS_* constants
* @param string $calendarUri The url to the calendar thats being shared
- * @param string $inReplyTo The unique id this message is a response to
- * @param string $summary A description of the reply
- * @return null|string
+ * @param string $inReplyTo The unique id this message is a response to
+ * @param string $summary A description of the reply
+ *
+ * @return string|null
*/
- function shareReply($href, $status, $calendarUri, $inReplyTo, $summary = null) {
-
+ public function shareReply($href, $status, $calendarUri, $inReplyTo, $summary = null)
+ {
if (!$this->caldavBackend instanceof Backend\SharingSupport) {
throw new DAV\Exception\NotImplemented('Sharing support is not implemented by this backend.');
}
return $this->caldavBackend->shareReply($href, $status, $calendarUri, $inReplyTo, $summary);
-
}
/**
@@ -367,12 +348,11 @@ class CalendarHome implements DAV\IExtendedCollection, DAVACL\IACL {
* collection should be ignored.
*
* @param string $uid
+ *
* @return string|null
*/
- function getCalendarObjectByUID($uid) {
-
+ public function getCalendarObjectByUID($uid)
+ {
return $this->caldavBackend->getCalendarObjectByUID($this->principalInfo['uri'], $uid);
-
}
-
}
diff --git a/vendor/sabre/dav/lib/CalDAV/CalendarObject.php b/vendor/sabre/dav/lib/CalDAV/CalendarObject.php
index 9d6532a35..3f28ee7f7 100644
--- a/vendor/sabre/dav/lib/CalDAV/CalendarObject.php
+++ b/vendor/sabre/dav/lib/CalDAV/CalendarObject.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CalDAV;
/**
@@ -9,33 +11,33 @@ namespace Sabre\CalDAV;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-class CalendarObject extends \Sabre\DAV\File implements ICalendarObject, \Sabre\DAVACL\IACL {
-
+class CalendarObject extends \Sabre\DAV\File implements ICalendarObject, \Sabre\DAVACL\IACL
+{
use \Sabre\DAVACL\ACLTrait;
/**
- * Sabre\CalDAV\Backend\BackendInterface
+ * Sabre\CalDAV\Backend\BackendInterface.
*
* @var Backend\AbstractBackend
*/
protected $caldavBackend;
/**
- * Array with information about this CalendarObject
+ * Array with information about this CalendarObject.
*
* @var array
*/
protected $objectData;
/**
- * Array with information about the containing calendar
+ * Array with information about the containing calendar.
*
* @var array
*/
protected $calendarInfo;
/**
- * Constructor
+ * Constructor.
*
* The following properties may be passed within $objectData:
*
@@ -49,11 +51,11 @@ class CalendarObject extends \Sabre\DAV\File implements ICalendarObject, \Sabre\
* * acl - (optional) Use this to override the default ACL for the node.
*
* @param Backend\BackendInterface $caldavBackend
- * @param array $calendarInfo
- * @param array $objectData
+ * @param array $calendarInfo
+ * @param array $objectData
*/
- function __construct(Backend\BackendInterface $caldavBackend, array $calendarInfo, array $objectData) {
-
+ public function __construct(Backend\BackendInterface $caldavBackend, array $calendarInfo, array $objectData)
+ {
$this->caldavBackend = $caldavBackend;
if (!isset($objectData['uri'])) {
@@ -62,44 +64,43 @@ class CalendarObject extends \Sabre\DAV\File implements ICalendarObject, \Sabre\
$this->calendarInfo = $calendarInfo;
$this->objectData = $objectData;
-
}
/**
- * Returns the uri for this object
+ * Returns the uri for this object.
*
* @return string
*/
- function getName() {
-
+ public function getName()
+ {
return $this->objectData['uri'];
-
}
/**
- * Returns the ICalendar-formatted object
+ * Returns the ICalendar-formatted object.
*
* @return string
*/
- function get() {
-
+ public function get()
+ {
// Pre-populating the 'calendardata' is optional, if we don't have it
// already we fetch it from the backend.
if (!isset($this->objectData['calendardata'])) {
$this->objectData = $this->caldavBackend->getCalendarObject($this->calendarInfo['id'], $this->objectData['uri']);
}
- return $this->objectData['calendardata'];
+ return $this->objectData['calendardata'];
}
/**
- * Updates the ICalendar-formatted object
+ * Updates the ICalendar-formatted object.
*
* @param string|resource $calendarData
+ *
* @return string
*/
- function put($calendarData) {
-
+ public function put($calendarData)
+ {
if (is_resource($calendarData)) {
$calendarData = stream_get_contents($calendarData);
}
@@ -108,33 +109,29 @@ class CalendarObject extends \Sabre\DAV\File implements ICalendarObject, \Sabre\
$this->objectData['etag'] = $etag;
return $etag;
-
}
/**
- * Deletes the calendar object
- *
- * @return void
+ * Deletes the calendar object.
*/
- function delete() {
-
+ public function delete()
+ {
$this->caldavBackend->deleteCalendarObject($this->calendarInfo['id'], $this->objectData['uri']);
-
}
/**
- * Returns the mime content-type
+ * Returns the mime content-type.
*
* @return string
*/
- function getContentType() {
-
+ public function getContentType()
+ {
$mime = 'text/calendar; charset=utf-8';
if (isset($this->objectData['component']) && $this->objectData['component']) {
- $mime .= '; component=' . $this->objectData['component'];
+ $mime .= '; component='.$this->objectData['component'];
}
- return $mime;
+ return $mime;
}
/**
@@ -144,53 +141,49 @@ class CalendarObject extends \Sabre\DAV\File implements ICalendarObject, \Sabre\
*
* @return string
*/
- function getETag() {
-
+ public function getETag()
+ {
if (isset($this->objectData['etag'])) {
return $this->objectData['etag'];
} else {
- return '"' . md5($this->get()) . '"';
+ return '"'.md5($this->get()).'"';
}
-
}
/**
- * Returns the last modification date as a unix timestamp
+ * Returns the last modification date as a unix timestamp.
*
* @return int
*/
- function getLastModified() {
-
+ public function getLastModified()
+ {
return $this->objectData['lastmodified'];
-
}
/**
- * Returns the size of this object in bytes
+ * Returns the size of this object in bytes.
*
* @return int
*/
- function getSize() {
-
+ public function getSize()
+ {
if (array_key_exists('size', $this->objectData)) {
return $this->objectData['size'];
} else {
return strlen($this->get());
}
-
}
/**
- * Returns the owner principal
+ * Returns the owner principal.
*
* This must be a url to a principal, or null if there's no owner
*
* @return string|null
*/
- function getOwner() {
-
+ public function getOwner()
+ {
return $this->calendarInfo['principaluri'];
-
}
/**
@@ -205,8 +198,8 @@ class CalendarObject extends \Sabre\DAV\File implements ICalendarObject, \Sabre\
*
* @return array
*/
- function getACL() {
-
+ public function getACL()
+ {
// An alternative acl may be specified in the object data.
if (isset($this->objectData['acl'])) {
return $this->objectData['acl'];
@@ -221,17 +214,14 @@ class CalendarObject extends \Sabre\DAV\File implements ICalendarObject, \Sabre\
],
[
'privilege' => '{DAV:}all',
- 'principal' => $this->calendarInfo['principaluri'] . '/calendar-proxy-write',
+ 'principal' => $this->calendarInfo['principaluri'].'/calendar-proxy-write',
'protected' => true,
],
[
'privilege' => '{DAV:}read',
- 'principal' => $this->calendarInfo['principaluri'] . '/calendar-proxy-read',
+ 'principal' => $this->calendarInfo['principaluri'].'/calendar-proxy-read',
'protected' => true,
],
-
];
-
}
-
}
diff --git a/vendor/sabre/dav/lib/CalDAV/CalendarQueryValidator.php b/vendor/sabre/dav/lib/CalDAV/CalendarQueryValidator.php
index df8008fe2..0e7f1307d 100644
--- a/vendor/sabre/dav/lib/CalDAV/CalendarQueryValidator.php
+++ b/vendor/sabre/dav/lib/CalDAV/CalendarQueryValidator.php
@@ -1,12 +1,14 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CalDAV;
use DateTime;
use Sabre\VObject;
/**
- * CalendarQuery Validator
+ * CalendarQuery Validator.
*
* This class is responsible for checking if an iCalendar object matches a set
* of filters. The main function to do this is 'validate'.
@@ -18,19 +20,20 @@ use Sabre\VObject;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-class CalendarQueryValidator {
-
+class CalendarQueryValidator
+{
/**
- * Verify if a list of filters applies to the calendar data object
+ * Verify if a list of filters applies to the calendar data object.
*
* The list of filters must be formatted as parsed by \Sabre\CalDAV\CalendarQueryParser
*
* @param VObject\Component\VCalendar $vObject
- * @param array $filters
+ * @param array $filters
+ *
* @return bool
*/
- function validate(VObject\Component\VCalendar $vObject, array $filters) {
-
+ public function validate(VObject\Component\VCalendar $vObject, array $filters)
+ {
// The top level object is always a component filter.
// We'll parse it manually, as it's pretty simple.
if ($vObject->name !== $filters['name']) {
@@ -40,8 +43,6 @@ class CalendarQueryValidator {
return
$this->validateCompFilters($vObject, $filters['comp-filters']) &&
$this->validatePropFilters($vObject, $filters['prop-filters']);
-
-
}
/**
@@ -52,23 +53,21 @@ class CalendarQueryValidator {
* itself.
*
* @param VObject\Component $parent
- * @param array $filters
+ * @param array $filters
+ *
* @return bool
*/
- protected function validateCompFilters(VObject\Component $parent, array $filters) {
-
+ protected function validateCompFilters(VObject\Component $parent, array $filters)
+ {
foreach ($filters as $filter) {
-
$isDefined = isset($parent->{$filter['name']});
if ($filter['is-not-defined']) {
-
if ($isDefined) {
return false;
} else {
continue;
}
-
}
if (!$isDefined) {
return false;
@@ -80,6 +79,7 @@ class CalendarQueryValidator {
continue 2;
}
}
+
return false;
}
@@ -90,27 +90,23 @@ class CalendarQueryValidator {
// If there are sub-filters, we need to find at least one component
// for which the subfilters hold true.
foreach ($parent->{$filter['name']} as $subComponent) {
-
if (
$this->validateCompFilters($subComponent, $filter['comp-filters']) &&
$this->validatePropFilters($subComponent, $filter['prop-filters'])) {
- // We had a match, so this comp-filter succeeds
- continue 2;
+ // We had a match, so this comp-filter succeeds
+ continue 2;
}
-
}
// If we got here it means there were sub-comp-filters or
// sub-prop-filters and there was no match. This means this filter
// needs to return false.
return false;
-
}
// If we got here it means we got through all comp-filters alive so the
// filters were all true.
return true;
-
}
/**
@@ -121,23 +117,21 @@ class CalendarQueryValidator {
* itself.
*
* @param VObject\Component $parent
- * @param array $filters
+ * @param array $filters
+ *
* @return bool
*/
- protected function validatePropFilters(VObject\Component $parent, array $filters) {
-
+ protected function validatePropFilters(VObject\Component $parent, array $filters)
+ {
foreach ($filters as $filter) {
-
$isDefined = isset($parent->{$filter['name']});
if ($filter['is-not-defined']) {
-
if ($isDefined) {
return false;
} else {
continue;
}
-
}
if (!$isDefined) {
return false;
@@ -149,6 +143,7 @@ class CalendarQueryValidator {
continue 2;
}
}
+
return false;
}
@@ -159,7 +154,6 @@ class CalendarQueryValidator {
// If there are sub-filters, we need to find at least one property
// for which the subfilters hold true.
foreach ($parent->{$filter['name']} as $subComponent) {
-
if (
$this->validateParamFilters($subComponent, $filter['param-filters']) &&
(!$filter['text-match'] || $this->validateTextMatch($subComponent, $filter['text-match']))
@@ -167,20 +161,17 @@ class CalendarQueryValidator {
// We had a match, so this prop-filter succeeds
continue 2;
}
-
}
// If we got here it means there were sub-param-filters or
// text-match filters and there was no match. This means the
// filter needs to return false.
return false;
-
}
// If we got here it means we got through all prop-filters alive so the
// filters were all true.
return true;
-
}
/**
@@ -191,23 +182,21 @@ class CalendarQueryValidator {
* itself.
*
* @param VObject\Property $parent
- * @param array $filters
+ * @param array $filters
+ *
* @return bool
*/
- protected function validateParamFilters(VObject\Property $parent, array $filters) {
-
+ protected function validateParamFilters(VObject\Property $parent, array $filters)
+ {
foreach ($filters as $filter) {
-
$isDefined = isset($parent[$filter['name']]);
if ($filter['is-not-defined']) {
-
if ($isDefined) {
return false;
} else {
continue;
}
-
}
if (!$isDefined) {
return false;
@@ -220,24 +209,20 @@ class CalendarQueryValidator {
// If there are sub-filters, we need to find at least one parameter
// for which the subfilters hold true.
foreach ($parent[$filter['name']]->getParts() as $paramPart) {
-
if ($this->validateTextMatch($paramPart, $filter['text-match'])) {
// We had a match, so this param-filter succeeds
continue 2;
}
-
}
// If we got here it means there was a text-match filter and there
// were no matches. This means the filter needs to return false.
return false;
-
}
// If we got here it means we got through all param-filters alive so the
// filters were all true.
return true;
-
}
/**
@@ -246,20 +231,20 @@ class CalendarQueryValidator {
* A single text-match should be specified as well as the specific property
* or parameter we need to validate.
*
- * @param VObject\Node|string $check Value to check against.
- * @param array $textMatch
+ * @param VObject\Node|string $check value to check against
+ * @param array $textMatch
+ *
* @return bool
*/
- protected function validateTextMatch($check, array $textMatch) {
-
+ protected function validateTextMatch($check, array $textMatch)
+ {
if ($check instanceof VObject\Node) {
$check = $check->getValue();
}
$isMatching = \Sabre\DAV\StringUtil::textMatch($check, $textMatch['value'], $textMatch['collation']);
- return ($textMatch['negate-condition'] xor $isMatching);
-
+ return $textMatch['negate-condition'] xor $isMatching;
}
/**
@@ -269,12 +254,13 @@ class CalendarQueryValidator {
* complex.
*
* @param VObject\Node $component
- * @param DateTime $start
- * @param DateTime $end
+ * @param DateTime $start
+ * @param DateTime $end
+ *
* @return bool
*/
- protected function validateTimeRange(VObject\Node $component, $start, $end) {
-
+ protected function validateTimeRange(VObject\Node $component, $start, $end)
+ {
if (is_null($start)) {
$start = new DateTime('1900-01-01');
}
@@ -283,14 +269,13 @@ class CalendarQueryValidator {
}
switch ($component->name) {
-
- case 'VEVENT' :
- case 'VTODO' :
- case 'VJOURNAL' :
+ case 'VEVENT':
+ case 'VTODO':
+ case 'VJOURNAL':
return $component->isInTimeRange($start, $end);
- case 'VALARM' :
+ case 'VALARM':
// If the valarm is wrapped in a recurring event, we need to
// expand the recursions, and validate each.
@@ -298,10 +283,9 @@ class CalendarQueryValidator {
// Our datamodel doesn't easily allow us to do this straight
// in the VALARM component code, so this is a hack, and an
// expensive one too.
- if ($component->parent->name === 'VEVENT' && $component->parent->RRULE) {
-
+ if ('VEVENT' === $component->parent->name && $component->parent->RRULE) {
// Fire up the iterator!
- $it = new VObject\Recur\EventIterator($component->parent->parent, (string)$component->parent->UID);
+ $it = new VObject\Recur\EventIterator($component->parent->parent, (string) $component->parent->UID);
while ($it->valid()) {
$expandedEvent = $it->getEventObject();
@@ -309,15 +293,14 @@ class CalendarQueryValidator {
// one is the first to trigger. Based on this, we can
// determine if we can 'give up' expanding events.
$firstAlarm = null;
- if ($expandedEvent->VALARM !== null) {
+ if (null !== $expandedEvent->VALARM) {
foreach ($expandedEvent->VALARM as $expandedAlarm) {
-
$effectiveTrigger = $expandedAlarm->getEffectiveTriggerTime();
if ($expandedAlarm->isInTimeRange($start, $end)) {
return true;
}
- if ((string)$expandedAlarm->TRIGGER['VALUE'] === 'DATE-TIME') {
+ if ('DATE-TIME' === (string) $expandedAlarm->TRIGGER['VALUE']) {
// This is an alarm with a non-relative trigger
// time, likely created by a buggy client. The
// implication is that every alarm in this
@@ -346,30 +329,26 @@ class CalendarQueryValidator {
}
$it->next();
}
+
return false;
} else {
return $component->isInTimeRange($start, $end);
}
- case 'VFREEBUSY' :
- throw new \Sabre\DAV\Exception\NotImplemented('time-range filters are currently not supported on ' . $component->name . ' components');
-
- case 'COMPLETED' :
- case 'CREATED' :
- case 'DTEND' :
- case 'DTSTAMP' :
- case 'DTSTART' :
- case 'DUE' :
- case 'LAST-MODIFIED' :
- return ($start <= $component->getDateTime() && $end >= $component->getDateTime());
-
-
-
- default :
- throw new \Sabre\DAV\Exception\BadRequest('You cannot create a time-range filter on a ' . $component->name . ' component');
-
+ // no break
+ case 'VFREEBUSY':
+ throw new \Sabre\DAV\Exception\NotImplemented('time-range filters are currently not supported on '.$component->name.' components');
+ case 'COMPLETED':
+ case 'CREATED':
+ case 'DTEND':
+ case 'DTSTAMP':
+ case 'DTSTART':
+ case 'DUE':
+ case 'LAST-MODIFIED':
+ return $start <= $component->getDateTime() && $end >= $component->getDateTime();
+
+ default:
+ throw new \Sabre\DAV\Exception\BadRequest('You cannot create a time-range filter on a '.$component->name.' component');
}
-
}
-
}
diff --git a/vendor/sabre/dav/lib/CalDAV/CalendarRoot.php b/vendor/sabre/dav/lib/CalDAV/CalendarRoot.php
index 1d6b2ac9f..42f1a44d5 100644
--- a/vendor/sabre/dav/lib/CalDAV/CalendarRoot.php
+++ b/vendor/sabre/dav/lib/CalDAV/CalendarRoot.php
@@ -1,11 +1,13 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CalDAV;
use Sabre\DAVACL\PrincipalBackend;
/**
- * Calendars collection
+ * Calendars collection.
*
* This object is responsible for generating a list of calendar-homes for each
* user.
@@ -17,17 +19,17 @@ use Sabre\DAVACL\PrincipalBackend;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-class CalendarRoot extends \Sabre\DAVACL\AbstractPrincipalCollection {
-
+class CalendarRoot extends \Sabre\DAVACL\AbstractPrincipalCollection
+{
/**
- * CalDAV backend
+ * CalDAV backend.
*
* @var Backend\BackendInterface
*/
protected $caldavBackend;
/**
- * Constructor
+ * Constructor.
*
* This constructor needs both an authentication and a caldav backend.
*
@@ -37,28 +39,26 @@ class CalendarRoot extends \Sabre\DAVACL\AbstractPrincipalCollection {
* to override this.
*
* @param PrincipalBackend\BackendInterface $principalBackend
- * @param Backend\BackendInterface $caldavBackend
- * @param string $principalPrefix
+ * @param Backend\BackendInterface $caldavBackend
+ * @param string $principalPrefix
*/
- function __construct(PrincipalBackend\BackendInterface $principalBackend, Backend\BackendInterface $caldavBackend, $principalPrefix = 'principals') {
-
+ public function __construct(PrincipalBackend\BackendInterface $principalBackend, Backend\BackendInterface $caldavBackend, $principalPrefix = 'principals')
+ {
parent::__construct($principalBackend, $principalPrefix);
$this->caldavBackend = $caldavBackend;
-
}
/**
- * Returns the nodename
+ * Returns the nodename.
*
* We're overriding this, because the default will be the 'principalPrefix',
* and we want it to be Sabre\CalDAV\Plugin::CALENDAR_ROOT
*
* @return string
*/
- function getName() {
-
+ public function getName()
+ {
return Plugin::CALENDAR_ROOT;
-
}
/**
@@ -69,12 +69,11 @@ class CalendarRoot extends \Sabre\DAVACL\AbstractPrincipalCollection {
* supplied by the authentication backend.
*
* @param array $principal
+ *
* @return \Sabre\DAV\INode
*/
- function getChildForPrincipal(array $principal) {
-
+ public function getChildForPrincipal(array $principal)
+ {
return new CalendarHome($this->caldavBackend, $principal);
-
}
-
}
diff --git a/vendor/sabre/dav/lib/CalDAV/Exception/InvalidComponentType.php b/vendor/sabre/dav/lib/CalDAV/Exception/InvalidComponentType.php
index 7aff2edab..3385ad8fe 100644
--- a/vendor/sabre/dav/lib/CalDAV/Exception/InvalidComponentType.php
+++ b/vendor/sabre/dav/lib/CalDAV/Exception/InvalidComponentType.php
@@ -1,35 +1,34 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CalDAV\Exception;
use Sabre\CalDAV;
use Sabre\DAV;
/**
- * InvalidComponentType
+ * InvalidComponentType.
*
* @copyright Copyright (C) fruux GmbH (https://fruux.com/)
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-class InvalidComponentType extends DAV\Exception\Forbidden {
-
+class InvalidComponentType extends DAV\Exception\Forbidden
+{
/**
* Adds in extra information in the xml response.
*
* This method adds the {CALDAV:}supported-calendar-component as defined in rfc4791
*
- * @param DAV\Server $server
+ * @param DAV\Server $server
* @param \DOMElement $errorNode
- * @return void
*/
- function serialize(DAV\Server $server, \DOMElement $errorNode) {
-
+ public function serialize(DAV\Server $server, \DOMElement $errorNode)
+ {
$doc = $errorNode->ownerDocument;
$np = $doc->createElementNS(CalDAV\Plugin::NS_CALDAV, 'cal:supported-calendar-component');
$errorNode->appendChild($np);
-
}
-
}
diff --git a/vendor/sabre/dav/lib/CalDAV/ICSExportPlugin.php b/vendor/sabre/dav/lib/CalDAV/ICSExportPlugin.php
index fc8b971f3..717d3a9c9 100644
--- a/vendor/sabre/dav/lib/CalDAV/ICSExportPlugin.php
+++ b/vendor/sabre/dav/lib/CalDAV/ICSExportPlugin.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CalDAV;
use DateTime;
@@ -11,7 +13,7 @@ use Sabre\HTTP\ResponseInterface;
use Sabre\VObject;
/**
- * ICS Exporter
+ * ICS Exporter.
*
* This plugin adds the ability to export entire calendars as .ics files.
* This is useful for clients that don't support CalDAV yet. They often do
@@ -44,44 +46,49 @@ use Sabre\VObject;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-class ICSExportPlugin extends DAV\ServerPlugin {
-
+class ICSExportPlugin extends DAV\ServerPlugin
+{
/**
- * Reference to Server class
+ * Reference to Server class.
*
* @var \Sabre\DAV\Server
*/
protected $server;
/**
- * Initializes the plugin and registers event handlers
+ * Initializes the plugin and registers event handlers.
*
* @param \Sabre\DAV\Server $server
- * @return void
*/
- function initialize(DAV\Server $server) {
-
+ public function initialize(DAV\Server $server)
+ {
$this->server = $server;
$server->on('method:GET', [$this, 'httpGet'], 90);
- $server->on('browserButtonActions', function($path, $node, &$actions) {
+ $server->on('browserButtonActions', function ($path, $node, &$actions) {
if ($node instanceof ICalendar) {
- $actions .= '<a href="' . htmlspecialchars($path, ENT_QUOTES, 'UTF-8') . '?export"><span class="oi" data-glyph="calendar"></span></a>';
+ $actions .= '<a href="'.htmlspecialchars($path, ENT_QUOTES, 'UTF-8').'?export"><span class="oi" data-glyph="calendar"></span></a>';
}
});
-
}
/**
* Intercepts GET requests on calendar urls ending with ?export.
*
- * @param RequestInterface $request
+ * @param RequestInterface $request
* @param ResponseInterface $response
+ *
+ * @throws BadRequest
+ * @throws DAV\Exception\NotFound
+ * @throws VObject\InvalidDataException
+ *
* @return bool
*/
- function httpGet(RequestInterface $request, ResponseInterface $response) {
-
+ public function httpGet(RequestInterface $request, ResponseInterface $response)
+ {
$queryParams = $request->getQueryParameters();
- if (!array_key_exists('export', $queryParams)) return;
+ if (!array_key_exists('export', $queryParams)) {
+ return;
+ }
$path = $request->getPath();
@@ -93,7 +100,7 @@ class ICSExportPlugin extends DAV\ServerPlugin {
'{http://apple.com/ns/ical/}calendar-color',
]);
- if (!isset($node['{DAV:}resourcetype']) || !$node['{DAV:}resourcetype']->is('{' . Plugin::NS_CALDAV . '}calendar')) {
+ if (!isset($node['{DAV:}resourcetype']) || !$node['{DAV:}resourcetype']->is('{'.Plugin::NS_CALDAV.'}calendar')) {
return;
}
// Marking the transactionType, for logging purposes.
@@ -117,7 +124,7 @@ class ICSExportPlugin extends DAV\ServerPlugin {
}
$end = DateTime::createFromFormat('U', $queryParams['end']);
}
- if (isset($queryParams['expand']) && !!$queryParams['expand']) {
+ if (isset($queryParams['expand']) && (bool) $queryParams['expand']) {
if (!$start || !$end) {
throw new BadRequest('If you\'d like to expand recurrences, you must specify both a start= and end= parameter.');
}
@@ -126,12 +133,12 @@ class ICSExportPlugin extends DAV\ServerPlugin {
}
if (isset($queryParams['componentType'])) {
if (!in_array($queryParams['componentType'], ['VEVENT', 'VTODO', 'VJOURNAL'])) {
- throw new BadRequest('You are not allowed to search for components of type: ' . $queryParams['componentType'] . ' here');
+ throw new BadRequest('You are not allowed to search for components of type: '.$queryParams['componentType'].' here');
}
$componentType = $queryParams['componentType'];
}
- $format = \Sabre\HTTP\Util::Negotiate(
+ $format = \Sabre\HTTP\negotiateContentType(
$request->getHeader('Accept'),
[
'text/calendar',
@@ -140,7 +147,7 @@ class ICSExportPlugin extends DAV\ServerPlugin {
);
if (isset($queryParams['accept'])) {
- if ($queryParams['accept'] === 'application/calendar+json' || $queryParams['accept'] === 'jcal') {
+ if ('application/calendar+json' === $queryParams['accept'] || 'jcal' === $queryParams['accept']) {
$format = 'application/calendar+json';
}
}
@@ -152,61 +159,61 @@ class ICSExportPlugin extends DAV\ServerPlugin {
// Returning false to break the event chain
return false;
-
}
/**
* This method is responsible for generating the actual, full response.
*
- * @param string $path
- * @param DateTime|null $start
- * @param DateTime|null $end
- * @param bool $expand
- * @param string $componentType
- * @param string $format
- * @param array $properties
+ * @param string $path
+ * @param DateTime|null $start
+ * @param DateTime|null $end
+ * @param bool $expand
+ * @param string $componentType
+ * @param string $format
+ * @param array $properties
* @param ResponseInterface $response
+ *
+ * @throws DAV\Exception\NotFound
+ * @throws VObject\InvalidDataException
*/
- protected function generateResponse($path, $start, $end, $expand, $componentType, $format, $properties, ResponseInterface $response) {
-
- $calDataProp = '{' . Plugin::NS_CALDAV . '}calendar-data';
+ protected function generateResponse($path, $start, $end, $expand, $componentType, $format, $properties, ResponseInterface $response)
+ {
+ $calDataProp = '{'.Plugin::NS_CALDAV.'}calendar-data';
$calendarNode = $this->server->tree->getNodeForPath($path);
$blobs = [];
if ($start || $end || $componentType) {
-
// If there was a start or end filter, we need to enlist
// calendarQuery for speed.
$queryResult = $calendarNode->calendarQuery([
- 'name' => 'VCALENDAR',
+ 'name' => 'VCALENDAR',
'comp-filters' => [
[
- 'name' => $componentType,
- 'comp-filters' => [],
- 'prop-filters' => [],
+ 'name' => $componentType,
+ 'comp-filters' => [],
+ 'prop-filters' => [],
'is-not-defined' => false,
- 'time-range' => [
+ 'time-range' => [
'start' => $start,
- 'end' => $end,
+ 'end' => $end,
],
],
],
- 'prop-filters' => [],
+ 'prop-filters' => [],
'is-not-defined' => false,
- 'time-range' => null,
+ 'time-range' => null,
]);
// queryResult is just a list of base urls. We need to prefix the
// calendar path.
$queryResult = array_map(
- function($item) use ($path) {
- return $path . '/' . $item;
+ function ($item) use ($path) {
+ return $path.'/'.$item;
},
$queryResult
);
$nodes = $this->server->getPropertiesForMultiplePaths($queryResult, [$calDataProp]);
unset($queryResult);
-
} else {
$nodes = $this->server->getPropertiesForPath($path, [$calDataProp], 1);
}
@@ -228,7 +235,7 @@ class ICSExportPlugin extends DAV\ServerPlugin {
$calendarTimeZone = null;
// We're expanding, and for that we need to figure out the
// calendar's timezone.
- $tzProp = '{' . Plugin::NS_CALDAV . '}calendar-timezone';
+ $tzProp = '{'.Plugin::NS_CALDAV.'}calendar-timezone';
$tzResult = $this->server->getProperties($path, [$tzProp]);
if (isset($tzResult[$tzProp])) {
// This property contains a VCALENDAR with a single
@@ -249,11 +256,11 @@ class ICSExportPlugin extends DAV\ServerPlugin {
$filenameExtension = '.ics';
switch ($format) {
- case 'text/calendar' :
+ case 'text/calendar':
$mergedCalendar = $mergedCalendar->serialize();
$filenameExtension = '.ics';
break;
- case 'application/calendar+json' :
+ case 'application/calendar+json':
$mergedCalendar = json_encode($mergedCalendar->jsonSerialize());
$filenameExtension = '.json';
break;
@@ -264,29 +271,29 @@ class ICSExportPlugin extends DAV\ServerPlugin {
'',
$calendarNode->getName()
);
- $filename .= '-' . date('Y-m-d') . $filenameExtension;
+ $filename .= '-'.date('Y-m-d').$filenameExtension;
- $response->setHeader('Content-Disposition', 'attachment; filename="' . $filename . '"');
+ $response->setHeader('Content-Disposition', 'attachment; filename="'.$filename.'"');
$response->setHeader('Content-Type', $format);
$response->setStatus(200);
$response->setBody($mergedCalendar);
-
}
/**
* Merges all calendar objects, and builds one big iCalendar blob.
*
- * @param array $properties Some CalDAV properties
+ * @param array $properties Some CalDAV properties
* @param array $inputObjects
+ *
* @return VObject\Component\VCalendar
*/
- function mergeObjects(array $properties, array $inputObjects) {
-
+ public function mergeObjects(array $properties, array $inputObjects)
+ {
$calendar = new VObject\Component\VCalendar();
$calendar->VERSION = '2.0';
if (DAV\Server::$exposeVersion) {
- $calendar->PRODID = '-//SabreDAV//SabreDAV ' . DAV\Version::VERSION . '//EN';
+ $calendar->PRODID = '-//SabreDAV//SabreDAV '.DAV\Version::VERSION.'//EN';
} else {
$calendar->PRODID = '-//SabreDAV//SabreDAV//EN';
}
@@ -303,41 +310,41 @@ class ICSExportPlugin extends DAV\ServerPlugin {
$objects = [];
foreach ($inputObjects as $href => $inputObject) {
-
$nodeComp = VObject\Reader::read($inputObject);
foreach ($nodeComp->children() as $child) {
-
switch ($child->name) {
- case 'VEVENT' :
- case 'VTODO' :
- case 'VJOURNAL' :
+ case 'VEVENT':
+ case 'VTODO':
+ case 'VJOURNAL':
$objects[] = clone $child;
break;
// VTIMEZONE is special, because we need to filter out the duplicates
- case 'VTIMEZONE' :
+ case 'VTIMEZONE':
// Naively just checking tzid.
- if (in_array((string)$child->TZID, $collectedTimezones)) continue;
+ if (in_array((string) $child->TZID, $collectedTimezones)) {
+ break;
+ }
$timezones[] = clone $child;
$collectedTimezones[] = $child->TZID;
break;
-
}
-
}
// Destroy circular references to PHP will GC the object.
$nodeComp->destroy();
unset($nodeComp);
-
}
- foreach ($timezones as $tz) $calendar->add($tz);
- foreach ($objects as $obj) $calendar->add($obj);
+ foreach ($timezones as $tz) {
+ $calendar->add($tz);
+ }
+ foreach ($objects as $obj) {
+ $calendar->add($obj);
+ }
return $calendar;
-
}
/**
@@ -348,10 +355,9 @@ class ICSExportPlugin extends DAV\ServerPlugin {
*
* @return string
*/
- function getPluginName() {
-
+ public function getPluginName()
+ {
return 'ics-export';
-
}
/**
@@ -365,14 +371,12 @@ class ICSExportPlugin extends DAV\ServerPlugin {
*
* @return array
*/
- function getPluginInfo() {
-
+ public function getPluginInfo()
+ {
return [
- 'name' => $this->getPluginName(),
+ 'name' => $this->getPluginName(),
'description' => 'Adds the ability to export CalDAV calendars as a single iCalendar file.',
- 'link' => 'http://sabre.io/dav/ics-export-plugin/',
+ 'link' => 'http://sabre.io/dav/ics-export-plugin/',
];
-
}
-
}
diff --git a/vendor/sabre/dav/lib/CalDAV/ICalendar.php b/vendor/sabre/dav/lib/CalDAV/ICalendar.php
index 7cf4b1256..8636e0bae 100644
--- a/vendor/sabre/dav/lib/CalDAV/ICalendar.php
+++ b/vendor/sabre/dav/lib/CalDAV/ICalendar.php
@@ -1,11 +1,13 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CalDAV;
use Sabre\DAVACL;
/**
- * Calendar interface
+ * Calendar interface.
*
* Implement this interface to allow a node to be recognized as an calendar.
*
@@ -13,6 +15,6 @@ use Sabre\DAVACL;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-interface ICalendar extends ICalendarObjectContainer, DAVACL\IACL {
-
+interface ICalendar extends ICalendarObjectContainer, DAVACL\IACL
+{
}
diff --git a/vendor/sabre/dav/lib/CalDAV/ICalendarObject.php b/vendor/sabre/dav/lib/CalDAV/ICalendarObject.php
index b3a767b74..86d9be634 100644
--- a/vendor/sabre/dav/lib/CalDAV/ICalendarObject.php
+++ b/vendor/sabre/dav/lib/CalDAV/ICalendarObject.php
@@ -1,11 +1,13 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CalDAV;
use Sabre\DAV;
/**
- * CalendarObject interface
+ * CalendarObject interface.
*
* Extend the ICalendarObject interface to allow your custom nodes to be picked up as
* CalendarObjects.
@@ -16,6 +18,6 @@ use Sabre\DAV;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-interface ICalendarObject extends DAV\IFile {
-
+interface ICalendarObject extends DAV\IFile
+{
}
diff --git a/vendor/sabre/dav/lib/CalDAV/ICalendarObjectContainer.php b/vendor/sabre/dav/lib/CalDAV/ICalendarObjectContainer.php
index 0308b8a55..d9346f311 100644
--- a/vendor/sabre/dav/lib/CalDAV/ICalendarObjectContainer.php
+++ b/vendor/sabre/dav/lib/CalDAV/ICalendarObjectContainer.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CalDAV;
/**
@@ -15,8 +17,8 @@ namespace Sabre\CalDAV;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-interface ICalendarObjectContainer extends \Sabre\DAV\ICollection {
-
+interface ICalendarObjectContainer extends \Sabre\DAV\ICollection
+{
/**
* Performs a calendar-query on the contents of this calendar.
*
@@ -32,8 +34,8 @@ interface ICalendarObjectContainer extends \Sabre\DAV\ICollection {
* documented by \Sabre\CalDAV\CalendarQueryParser.
*
* @param array $filters
+ *
* @return array
*/
- function calendarQuery(array $filters);
-
+ public function calendarQuery(array $filters);
}
diff --git a/vendor/sabre/dav/lib/CalDAV/ISharedCalendar.php b/vendor/sabre/dav/lib/CalDAV/ISharedCalendar.php
index 15f3b5335..e3e9a7314 100644
--- a/vendor/sabre/dav/lib/CalDAV/ISharedCalendar.php
+++ b/vendor/sabre/dav/lib/CalDAV/ISharedCalendar.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CalDAV;
use Sabre\DAV\Sharing\ISharedNode;
@@ -11,8 +13,8 @@ use Sabre\DAV\Sharing\ISharedNode;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-interface ISharedCalendar extends ISharedNode {
-
+interface ISharedCalendar extends ISharedNode
+{
/**
* Marks this calendar as published.
*
@@ -20,7 +22,6 @@ interface ISharedCalendar extends ISharedNode {
* subscribable calendar.
*
* @param bool $value
- * @return void
*/
- function setPublishStatus($value);
+ public function setPublishStatus($value);
}
diff --git a/vendor/sabre/dav/lib/CalDAV/Notifications/Collection.php b/vendor/sabre/dav/lib/CalDAV/Notifications/Collection.php
index 557832a5a..884f205e4 100644
--- a/vendor/sabre/dav/lib/CalDAV/Notifications/Collection.php
+++ b/vendor/sabre/dav/lib/CalDAV/Notifications/Collection.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CalDAV\Notifications;
use Sabre\CalDAV;
@@ -20,49 +22,47 @@ use Sabre\DAVACL;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-class Collection extends DAV\Collection implements ICollection, DAVACL\IACL {
-
+class Collection extends DAV\Collection implements ICollection, DAVACL\IACL
+{
use DAVACL\ACLTrait;
/**
- * The notification backend
+ * The notification backend.
*
* @var CalDAV\Backend\NotificationSupport
*/
protected $caldavBackend;
/**
- * Principal uri
+ * Principal uri.
*
* @var string
*/
protected $principalUri;
/**
- * Constructor
+ * Constructor.
*
* @param CalDAV\Backend\NotificationSupport $caldavBackend
- * @param string $principalUri
+ * @param string $principalUri
*/
- function __construct(CalDAV\Backend\NotificationSupport $caldavBackend, $principalUri) {
-
+ public function __construct(CalDAV\Backend\NotificationSupport $caldavBackend, $principalUri)
+ {
$this->caldavBackend = $caldavBackend;
$this->principalUri = $principalUri;
-
}
/**
- * Returns all notifications for a principal
+ * Returns all notifications for a principal.
*
* @return array
*/
- function getChildren() {
-
+ public function getChildren()
+ {
$children = [];
$notifications = $this->caldavBackend->getNotificationsForPrincipal($this->principalUri);
foreach ($notifications as $notification) {
-
$children[] = new Node(
$this->caldavBackend,
$this->principalUri,
@@ -71,31 +71,27 @@ class Collection extends DAV\Collection implements ICollection, DAVACL\IACL {
}
return $children;
-
}
/**
- * Returns the name of this object
+ * Returns the name of this object.
*
* @return string
*/
- function getName() {
-
+ public function getName()
+ {
return 'notifications';
-
}
/**
- * Returns the owner principal
+ * Returns the owner principal.
*
* This must be a url to a principal, or null if there's no owner
*
* @return string|null
*/
- function getOwner() {
-
+ public function getOwner()
+ {
return $this->principalUri;
-
}
-
}
diff --git a/vendor/sabre/dav/lib/CalDAV/Notifications/ICollection.php b/vendor/sabre/dav/lib/CalDAV/Notifications/ICollection.php
index 008e87435..b12fb3909 100644
--- a/vendor/sabre/dav/lib/CalDAV/Notifications/ICollection.php
+++ b/vendor/sabre/dav/lib/CalDAV/Notifications/ICollection.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CalDAV\Notifications;
use Sabre\DAV;
@@ -18,6 +20,6 @@ use Sabre\DAV;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-interface ICollection extends DAV\ICollection {
-
+interface ICollection extends DAV\ICollection
+{
}
diff --git a/vendor/sabre/dav/lib/CalDAV/Notifications/INode.php b/vendor/sabre/dav/lib/CalDAV/Notifications/INode.php
index 783b92be9..c5897ef4e 100644
--- a/vendor/sabre/dav/lib/CalDAV/Notifications/INode.php
+++ b/vendor/sabre/dav/lib/CalDAV/Notifications/INode.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CalDAV\Notifications;
use Sabre\CalDAV\Xml\Notification\NotificationInterface;
@@ -18,15 +20,15 @@ use Sabre\CalDAV\Xml\Notification\NotificationInterface;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-interface INode {
-
+interface INode
+{
/**
* This method must return an xml element, using the
* Sabre\CalDAV\Xml\Notification\NotificationInterface classes.
*
* @return NotificationInterface
*/
- function getNotificationType();
+ public function getNotificationType();
/**
* Returns the etag for the notification.
@@ -35,6 +37,5 @@ interface INode {
*
* @return string
*/
- function getETag();
-
+ public function getETag();
}
diff --git a/vendor/sabre/dav/lib/CalDAV/Notifications/Node.php b/vendor/sabre/dav/lib/CalDAV/Notifications/Node.php
index ad7ddf8f5..b1ec13ff4 100644
--- a/vendor/sabre/dav/lib/CalDAV/Notifications/Node.php
+++ b/vendor/sabre/dav/lib/CalDAV/Notifications/Node.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CalDAV\Notifications;
use Sabre\CalDAV;
@@ -18,55 +20,53 @@ use Sabre\DAVACL;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-class Node extends DAV\File implements INode, DAVACL\IACL {
-
+class Node extends DAV\File implements INode, DAVACL\IACL
+{
use DAVACL\ACLTrait;
/**
- * The notification backend
+ * The notification backend.
*
* @var CalDAV\Backend\NotificationSupport
*/
protected $caldavBackend;
/**
- * The actual notification
+ * The actual notification.
*
* @var NotificationInterface
*/
protected $notification;
/**
- * Owner principal of the notification
+ * Owner principal of the notification.
*
* @var string
*/
protected $principalUri;
/**
- * Constructor
+ * Constructor.
*
* @param CalDAV\Backend\NotificationSupport $caldavBackend
- * @param string $principalUri
- * @param NotificationInterface $notification
+ * @param string $principalUri
+ * @param NotificationInterface $notification
*/
- function __construct(CalDAV\Backend\NotificationSupport $caldavBackend, $principalUri, NotificationInterface $notification) {
-
+ public function __construct(CalDAV\Backend\NotificationSupport $caldavBackend, $principalUri, NotificationInterface $notification)
+ {
$this->caldavBackend = $caldavBackend;
$this->principalUri = $principalUri;
$this->notification = $notification;
-
}
/**
- * Returns the path name for this notification
+ * Returns the path name for this notification.
*
* @return string
*/
- function getName() {
-
- return $this->notification->getId() . '.xml';
-
+ public function getName()
+ {
+ return $this->notification->getId().'.xml';
}
/**
@@ -76,10 +76,9 @@ class Node extends DAV\File implements INode, DAVACL\IACL {
*
* @return string
*/
- function getETag() {
-
+ public function getETag()
+ {
return $this->notification->getETag();
-
}
/**
@@ -88,34 +87,28 @@ class Node extends DAV\File implements INode, DAVACL\IACL {
*
* @return NotificationInterface
*/
- function getNotificationType() {
-
+ public function getNotificationType()
+ {
return $this->notification;
-
}
/**
- * Deletes this notification
- *
- * @return void
+ * Deletes this notification.
*/
- function delete() {
-
+ public function delete()
+ {
$this->caldavBackend->deleteNotification($this->getOwner(), $this->notification);
-
}
/**
- * Returns the owner principal
+ * Returns the owner principal.
*
* This must be a url to a principal, or null if there's no owner
*
* @return string|null
*/
- function getOwner() {
-
+ public function getOwner()
+ {
return $this->principalUri;
-
}
-
}
diff --git a/vendor/sabre/dav/lib/CalDAV/Notifications/Plugin.php b/vendor/sabre/dav/lib/CalDAV/Notifications/Plugin.php
index e742351f5..182b70c8e 100644
--- a/vendor/sabre/dav/lib/CalDAV/Notifications/Plugin.php
+++ b/vendor/sabre/dav/lib/CalDAV/Notifications/Plugin.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CalDAV\Notifications;
use Sabre\DAV;
@@ -12,7 +14,7 @@ use Sabre\HTTP\RequestInterface;
use Sabre\HTTP\ResponseInterface;
/**
- * Notifications plugin
+ * Notifications plugin.
*
* This plugin implements several features required by the caldav-notification
* draft specification.
@@ -24,10 +26,10 @@ use Sabre\HTTP\ResponseInterface;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-class Plugin extends ServerPlugin {
-
+class Plugin extends ServerPlugin
+{
/**
- * This is the namespace for the proprietary calendarserver extensions
+ * This is the namespace for the proprietary calendarserver extensions.
*/
const NS_CALENDARSERVER = 'http://calendarserver.org/ns/';
@@ -46,10 +48,9 @@ class Plugin extends ServerPlugin {
*
* @return string
*/
- function getPluginName() {
-
+ public function getPluginName()
+ {
return 'notifications';
-
}
/**
@@ -61,58 +62,49 @@ class Plugin extends ServerPlugin {
* This method should set up the required event subscriptions.
*
* @param Server $server
- * @return void
*/
- function initialize(Server $server) {
-
+ public function initialize(Server $server)
+ {
$this->server = $server;
$server->on('method:GET', [$this, 'httpGet'], 90);
- $server->on('propFind', [$this, 'propFind']);
+ $server->on('propFind', [$this, 'propFind']);
$server->xml->namespaceMap[self::NS_CALENDARSERVER] = 'cs';
- $server->resourceTypeMapping['\\Sabre\\CalDAV\\Notifications\\ICollection'] = '{' . self::NS_CALENDARSERVER . '}notification';
+ $server->resourceTypeMapping['\\Sabre\\CalDAV\\Notifications\\ICollection'] = '{'.self::NS_CALENDARSERVER.'}notification';
array_push($server->protectedProperties,
- '{' . self::NS_CALENDARSERVER . '}notification-URL',
- '{' . self::NS_CALENDARSERVER . '}notificationtype'
+ '{'.self::NS_CALENDARSERVER.'}notification-URL',
+ '{'.self::NS_CALENDARSERVER.'}notificationtype'
);
-
}
/**
- * PropFind
+ * PropFind.
*
- * @param PropFind $propFind
+ * @param PropFind $propFind
* @param BaseINode $node
- * @return void
*/
- function propFind(PropFind $propFind, BaseINode $node) {
-
+ public function propFind(PropFind $propFind, BaseINode $node)
+ {
$caldavPlugin = $this->server->getPlugin('caldav');
if ($node instanceof DAVACL\IPrincipal) {
-
$principalUrl = $node->getPrincipalUrl();
// notification-URL property
- $propFind->handle('{' . self::NS_CALENDARSERVER . '}notification-URL', function() use ($principalUrl, $caldavPlugin) {
+ $propFind->handle('{'.self::NS_CALENDARSERVER.'}notification-URL', function () use ($principalUrl, $caldavPlugin) {
+ $notificationPath = $caldavPlugin->getCalendarHomeForPrincipal($principalUrl).'/notifications/';
- $notificationPath = $caldavPlugin->getCalendarHomeForPrincipal($principalUrl) . '/notifications/';
return new DAV\Xml\Property\Href($notificationPath);
-
});
-
}
if ($node instanceof INode) {
-
$propFind->handle(
- '{' . self::NS_CALENDARSERVER . '}notificationtype',
+ '{'.self::NS_CALENDARSERVER.'}notificationtype',
[$node, 'getNotificationType']
);
-
}
-
}
/**
@@ -121,12 +113,11 @@ class Plugin extends ServerPlugin {
* We use this to intercept GET calls to notification nodes, and return the
* proper response.
*
- * @param RequestInterface $request
+ * @param RequestInterface $request
* @param ResponseInterface $response
- * @return void
*/
- function httpGet(RequestInterface $request, ResponseInterface $response) {
-
+ public function httpGet(RequestInterface $request, ResponseInterface $response)
+ {
$path = $request->getPath();
try {
@@ -135,8 +126,9 @@ class Plugin extends ServerPlugin {
return;
}
- if (!$node instanceof INode)
+ if (!$node instanceof INode) {
return;
+ }
$writer = $this->server->xml->getWriter();
$writer->contextUri = $this->server->getBaseUri();
@@ -153,7 +145,6 @@ class Plugin extends ServerPlugin {
// Return false to break the event chain.
return false;
-
}
/**
@@ -167,14 +158,12 @@ class Plugin extends ServerPlugin {
*
* @return array
*/
- function getPluginInfo() {
-
+ public function getPluginInfo()
+ {
return [
- 'name' => $this->getPluginName(),
+ 'name' => $this->getPluginName(),
'description' => 'Adds support for caldav-notifications, which is required to enable caldav-sharing.',
- 'link' => 'http://sabre.io/dav/caldav-sharing/',
+ 'link' => 'http://sabre.io/dav/caldav-sharing/',
];
-
}
-
}
diff --git a/vendor/sabre/dav/lib/CalDAV/Plugin.php b/vendor/sabre/dav/lib/CalDAV/Plugin.php
index def11d52d..04eaedf73 100644
--- a/vendor/sabre/dav/lib/CalDAV/Plugin.php
+++ b/vendor/sabre/dav/lib/CalDAV/Plugin.php
@@ -1,8 +1,11 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CalDAV;
use DateTimeZone;
+use Sabre\CalDAV\Xml\Request\CalendarMultiGetReport;
use Sabre\DAV;
use Sabre\DAV\Exception\BadRequest;
use Sabre\DAV\INode;
@@ -16,7 +19,7 @@ use Sabre\Uri;
use Sabre\VObject;
/**
- * CalDAV plugin
+ * CalDAV plugin.
*
* This plugin provides functionality added by CalDAV (RFC 4791)
* It implements new reports, and the MKCALENDAR method.
@@ -25,26 +28,26 @@ use Sabre\VObject;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-class Plugin extends DAV\ServerPlugin {
-
+class Plugin extends DAV\ServerPlugin
+{
/**
- * This is the official CalDAV namespace
+ * This is the official CalDAV namespace.
*/
const NS_CALDAV = 'urn:ietf:params:xml:ns:caldav';
/**
- * This is the namespace for the proprietary calendarserver extensions
+ * This is the namespace for the proprietary calendarserver extensions.
*/
const NS_CALENDARSERVER = 'http://calendarserver.org/ns/';
/**
* The hardcoded root for calendar objects. It is unfortunate
- * that we're stuck with it, but it will have to do for now
+ * that we're stuck with it, but it will have to do for now.
*/
const CALENDAR_ROOT = 'calendars';
/**
- * Reference to server object
+ * Reference to server object.
*
* @var DAV\Server
*/
@@ -65,14 +68,19 @@ class Plugin extends DAV\ServerPlugin {
* available for the specified uri.
*
* @param string $uri
+ *
* @return array
*/
- function getHTTPMethods($uri) {
-
+ public function getHTTPMethods($uri)
+ {
// The MKCALENDAR is only available on unmapped uri's, whose
// parents extend IExtendedCollection
list($parent, $name) = Uri\split($uri);
+ if ('' === $uri) {
+ $parent = '';
+ }
+
$node = $this->server->tree->getNodeForPath($parent);
if ($node instanceof DAV\IExtendedCollection) {
@@ -82,8 +90,8 @@ class Plugin extends DAV\ServerPlugin {
return ['MKCALENDAR'];
}
}
- return [];
+ return [];
}
/**
@@ -94,10 +102,11 @@ class Plugin extends DAV\ServerPlugin {
* a calendar home.
*
* @param string $principalUrl
+ *
* @return string
*/
- function getCalendarHomeForPrincipal($principalUrl) {
-
+ public function getCalendarHomeForPrincipal($principalUrl)
+ {
// The default behavior for most sabre/dav servers is that there is a
// principals root node, which contains users directly under it.
//
@@ -106,11 +115,14 @@ class Plugin extends DAV\ServerPlugin {
// excludes things like the calendar-proxy-read principal (which it
// should).
$parts = explode('/', trim($principalUrl, '/'));
- if (count($parts) !== 2) return;
- if ($parts[0] !== 'principals') return;
-
- return self::CALENDAR_ROOT . '/' . $parts[1];
+ if (2 !== count($parts)) {
+ return;
+ }
+ if ('principals' !== $parts[0]) {
+ return;
+ }
+ return self::CALENDAR_ROOT.'/'.$parts[1];
}
/**
@@ -118,10 +130,9 @@ class Plugin extends DAV\ServerPlugin {
*
* @return array
*/
- function getFeatures() {
-
+ public function getFeatures()
+ {
return ['calendar-access', 'calendar-proxy'];
-
}
/**
@@ -132,10 +143,9 @@ class Plugin extends DAV\ServerPlugin {
*
* @return string
*/
- function getPluginName() {
-
+ public function getPluginName()
+ {
return 'caldav';
-
}
/**
@@ -146,19 +156,20 @@ class Plugin extends DAV\ServerPlugin {
* implement them
*
* @param string $uri
+ *
* @return array
*/
- function getSupportedReportSet($uri) {
-
+ public function getSupportedReportSet($uri)
+ {
$node = $this->server->tree->getNodeForPath($uri);
$reports = [];
if ($node instanceof ICalendarObjectContainer || $node instanceof ICalendarObject) {
- $reports[] = '{' . self::NS_CALDAV . '}calendar-multiget';
- $reports[] = '{' . self::NS_CALDAV . '}calendar-query';
+ $reports[] = '{'.self::NS_CALDAV.'}calendar-multiget';
+ $reports[] = '{'.self::NS_CALDAV.'}calendar-query';
}
if ($node instanceof ICalendar) {
- $reports[] = '{' . self::NS_CALDAV . '}free-busy-query';
+ $reports[] = '{'.self::NS_CALDAV.'}free-busy-query';
}
// iCal has a bug where it assumes that sync support is enabled, only
// if we say we support it on the calendar-home, even though this is
@@ -166,39 +177,38 @@ class Plugin extends DAV\ServerPlugin {
if ($node instanceof CalendarHome && $this->server->getPlugin('sync')) {
$reports[] = '{DAV:}sync-collection';
}
- return $reports;
+ return $reports;
}
/**
- * Initializes the plugin
+ * Initializes the plugin.
*
* @param DAV\Server $server
- * @return void
*/
- function initialize(DAV\Server $server) {
-
+ public function initialize(DAV\Server $server)
+ {
$this->server = $server;
- $server->on('method:MKCALENDAR', [$this, 'httpMkCalendar']);
- $server->on('report', [$this, 'report']);
- $server->on('propFind', [$this, 'propFind']);
- $server->on('onHTMLActionsPanel', [$this, 'htmlActionsPanel']);
- $server->on('beforeCreateFile', [$this, 'beforeCreateFile']);
- $server->on('beforeWriteContent', [$this, 'beforeWriteContent']);
- $server->on('afterMethod:GET', [$this, 'httpAfterGET']);
+ $server->on('method:MKCALENDAR', [$this, 'httpMkCalendar']);
+ $server->on('report', [$this, 'report']);
+ $server->on('propFind', [$this, 'propFind']);
+ $server->on('onHTMLActionsPanel', [$this, 'htmlActionsPanel']);
+ $server->on('beforeCreateFile', [$this, 'beforeCreateFile']);
+ $server->on('beforeWriteContent', [$this, 'beforeWriteContent']);
+ $server->on('afterMethod:GET', [$this, 'httpAfterGET']);
$server->on('getSupportedPrivilegeSet', [$this, 'getSupportedPrivilegeSet']);
$server->xml->namespaceMap[self::NS_CALDAV] = 'cal';
$server->xml->namespaceMap[self::NS_CALENDARSERVER] = 'cs';
- $server->xml->elementMap['{' . self::NS_CALDAV . '}supported-calendar-component-set'] = 'Sabre\\CalDAV\\Xml\\Property\\SupportedCalendarComponentSet';
- $server->xml->elementMap['{' . self::NS_CALDAV . '}calendar-query'] = 'Sabre\\CalDAV\\Xml\\Request\\CalendarQueryReport';
- $server->xml->elementMap['{' . self::NS_CALDAV . '}calendar-multiget'] = 'Sabre\\CalDAV\\Xml\\Request\\CalendarMultiGetReport';
- $server->xml->elementMap['{' . self::NS_CALDAV . '}free-busy-query'] = 'Sabre\\CalDAV\\Xml\\Request\\FreeBusyQueryReport';
- $server->xml->elementMap['{' . self::NS_CALDAV . '}mkcalendar'] = 'Sabre\\CalDAV\\Xml\\Request\\MkCalendar';
- $server->xml->elementMap['{' . self::NS_CALDAV . '}schedule-calendar-transp'] = 'Sabre\\CalDAV\\Xml\\Property\\ScheduleCalendarTransp';
- $server->xml->elementMap['{' . self::NS_CALDAV . '}supported-calendar-component-set'] = 'Sabre\\CalDAV\\Xml\\Property\\SupportedCalendarComponentSet';
+ $server->xml->elementMap['{'.self::NS_CALDAV.'}supported-calendar-component-set'] = 'Sabre\\CalDAV\\Xml\\Property\\SupportedCalendarComponentSet';
+ $server->xml->elementMap['{'.self::NS_CALDAV.'}calendar-query'] = 'Sabre\\CalDAV\\Xml\\Request\\CalendarQueryReport';
+ $server->xml->elementMap['{'.self::NS_CALDAV.'}calendar-multiget'] = 'Sabre\\CalDAV\\Xml\\Request\\CalendarMultiGetReport';
+ $server->xml->elementMap['{'.self::NS_CALDAV.'}free-busy-query'] = 'Sabre\\CalDAV\\Xml\\Request\\FreeBusyQueryReport';
+ $server->xml->elementMap['{'.self::NS_CALDAV.'}mkcalendar'] = 'Sabre\\CalDAV\\Xml\\Request\\MkCalendar';
+ $server->xml->elementMap['{'.self::NS_CALDAV.'}schedule-calendar-transp'] = 'Sabre\\CalDAV\\Xml\\Property\\ScheduleCalendarTransp';
+ $server->xml->elementMap['{'.self::NS_CALDAV.'}supported-calendar-component-set'] = 'Sabre\\CalDAV\\Xml\\Property\\SupportedCalendarComponentSet';
$server->resourceTypeMapping['\\Sabre\\CalDAV\\ICalendar'] = '{urn:ietf:params:xml:ns:caldav}calendar';
@@ -206,86 +216,84 @@ class Plugin extends DAV\ServerPlugin {
$server->resourceTypeMapping['\\Sabre\\CalDAV\\Principal\\IProxyWrite'] = '{http://calendarserver.org/ns/}calendar-proxy-write';
array_push($server->protectedProperties,
-
- '{' . self::NS_CALDAV . '}supported-calendar-component-set',
- '{' . self::NS_CALDAV . '}supported-calendar-data',
- '{' . self::NS_CALDAV . '}max-resource-size',
- '{' . self::NS_CALDAV . '}min-date-time',
- '{' . self::NS_CALDAV . '}max-date-time',
- '{' . self::NS_CALDAV . '}max-instances',
- '{' . self::NS_CALDAV . '}max-attendees-per-instance',
- '{' . self::NS_CALDAV . '}calendar-home-set',
- '{' . self::NS_CALDAV . '}supported-collation-set',
- '{' . self::NS_CALDAV . '}calendar-data',
+ '{'.self::NS_CALDAV.'}supported-calendar-component-set',
+ '{'.self::NS_CALDAV.'}supported-calendar-data',
+ '{'.self::NS_CALDAV.'}max-resource-size',
+ '{'.self::NS_CALDAV.'}min-date-time',
+ '{'.self::NS_CALDAV.'}max-date-time',
+ '{'.self::NS_CALDAV.'}max-instances',
+ '{'.self::NS_CALDAV.'}max-attendees-per-instance',
+ '{'.self::NS_CALDAV.'}calendar-home-set',
+ '{'.self::NS_CALDAV.'}supported-collation-set',
+ '{'.self::NS_CALDAV.'}calendar-data',
// CalendarServer extensions
- '{' . self::NS_CALENDARSERVER . '}getctag',
- '{' . self::NS_CALENDARSERVER . '}calendar-proxy-read-for',
- '{' . self::NS_CALENDARSERVER . '}calendar-proxy-write-for'
-
+ '{'.self::NS_CALENDARSERVER.'}getctag',
+ '{'.self::NS_CALENDARSERVER.'}calendar-proxy-read-for',
+ '{'.self::NS_CALENDARSERVER.'}calendar-proxy-write-for'
);
if ($aclPlugin = $server->getPlugin('acl')) {
- $aclPlugin->principalSearchPropertySet['{' . self::NS_CALDAV . '}calendar-user-address-set'] = 'Calendar address';
+ $aclPlugin->principalSearchPropertySet['{'.self::NS_CALDAV.'}calendar-user-address-set'] = 'Calendar address';
}
}
/**
- * This functions handles REPORT requests specific to CalDAV
+ * This functions handles REPORT requests specific to CalDAV.
*
* @param string $reportName
- * @param mixed $report
- * @param mixed $path
+ * @param mixed $report
+ * @param mixed $path
+ *
* @return bool
*/
- function report($reportName, $report, $path) {
-
+ public function report($reportName, $report, $path)
+ {
switch ($reportName) {
- case '{' . self::NS_CALDAV . '}calendar-multiget' :
+ case '{'.self::NS_CALDAV.'}calendar-multiget':
$this->server->transactionType = 'report-calendar-multiget';
$this->calendarMultiGetReport($report);
+
return false;
- case '{' . self::NS_CALDAV . '}calendar-query' :
+ case '{'.self::NS_CALDAV.'}calendar-query':
$this->server->transactionType = 'report-calendar-query';
$this->calendarQueryReport($report);
+
return false;
- case '{' . self::NS_CALDAV . '}free-busy-query' :
+ case '{'.self::NS_CALDAV.'}free-busy-query':
$this->server->transactionType = 'report-free-busy-query';
$this->freeBusyQueryReport($report);
- return false;
+ return false;
}
-
-
}
/**
* This function handles the MKCALENDAR HTTP method, which creates
* a new calendar.
*
- * @param RequestInterface $request
+ * @param RequestInterface $request
* @param ResponseInterface $response
+ *
* @return bool
*/
- function httpMkCalendar(RequestInterface $request, ResponseInterface $response) {
-
+ public function httpMkCalendar(RequestInterface $request, ResponseInterface $response)
+ {
$body = $request->getBodyAsString();
$path = $request->getPath();
$properties = [];
if ($body) {
-
try {
$mkcalendar = $this->server->xml->expect(
'{urn:ietf:params:xml:ns:caldav}mkcalendar',
$body
);
} catch (\Sabre\Xml\ParseException $e) {
- throw new BadRequest($e->getMessage(), null, $e);
+ throw new BadRequest($e->getMessage(), 0, $e);
}
$properties = $mkcalendar->getProperties();
-
}
// iCal abuses MKCALENDAR since iCal 10.9.2 to create server-stored
@@ -297,7 +305,7 @@ class Plugin extends DAV\ServerPlugin {
if (isset($properties['{DAV:}resourcetype'])) {
$resourceType = $properties['{DAV:}resourcetype']->getValue();
} else {
- $resourceType = ['{DAV:}collection','{urn:ietf:params:xml:ns:caldav}calendar'];
+ $resourceType = ['{DAV:}collection', '{urn:ietf:params:xml:ns:caldav}calendar'];
}
$this->server->createCollection($path, new MkCol($resourceType, $properties));
@@ -310,80 +318,77 @@ class Plugin extends DAV\ServerPlugin {
}
/**
- * PropFind
+ * PropFind.
*
* This method handler is invoked before any after properties for a
* resource are fetched. This allows us to add in any CalDAV specific
* properties.
*
* @param DAV\PropFind $propFind
- * @param DAV\INode $node
- * @return void
+ * @param DAV\INode $node
*/
- function propFind(DAV\PropFind $propFind, DAV\INode $node) {
-
- $ns = '{' . self::NS_CALDAV . '}';
+ public function propFind(DAV\PropFind $propFind, DAV\INode $node)
+ {
+ $ns = '{'.self::NS_CALDAV.'}';
if ($node instanceof ICalendarObjectContainer) {
-
- $propFind->handle($ns . 'max-resource-size', $this->maxResourceSize);
- $propFind->handle($ns . 'supported-calendar-data', function() {
+ $propFind->handle($ns.'max-resource-size', $this->maxResourceSize);
+ $propFind->handle($ns.'supported-calendar-data', function () {
return new Xml\Property\SupportedCalendarData();
});
- $propFind->handle($ns . 'supported-collation-set', function() {
+ $propFind->handle($ns.'supported-collation-set', function () {
return new Xml\Property\SupportedCollationSet();
});
-
}
if ($node instanceof DAVACL\IPrincipal) {
-
$principalUrl = $node->getPrincipalUrl();
- $propFind->handle('{' . self::NS_CALDAV . '}calendar-home-set', function() use ($principalUrl) {
-
+ $propFind->handle('{'.self::NS_CALDAV.'}calendar-home-set', function () use ($principalUrl) {
$calendarHomePath = $this->getCalendarHomeForPrincipal($principalUrl);
- if (is_null($calendarHomePath)) return null;
- return new LocalHref($calendarHomePath . '/');
+ if (is_null($calendarHomePath)) {
+ return null;
+ }
+ return new LocalHref($calendarHomePath.'/');
});
// The calendar-user-address-set property is basically mapped to
// the {DAV:}alternate-URI-set property.
- $propFind->handle('{' . self::NS_CALDAV . '}calendar-user-address-set', function() use ($node) {
+ $propFind->handle('{'.self::NS_CALDAV.'}calendar-user-address-set', function () use ($node) {
$addresses = $node->getAlternateUriSet();
- $addresses[] = $this->server->getBaseUri() . $node->getPrincipalUrl() . '/';
+ $addresses[] = $this->server->getBaseUri().$node->getPrincipalUrl().'/';
+
return new LocalHref($addresses);
});
// For some reason somebody thought it was a good idea to add
// another one of these properties. We're supporting it too.
- $propFind->handle('{' . self::NS_CALENDARSERVER . '}email-address-set', function() use ($node) {
+ $propFind->handle('{'.self::NS_CALENDARSERVER.'}email-address-set', function () use ($node) {
$addresses = $node->getAlternateUriSet();
$emails = [];
foreach ($addresses as $address) {
- if (substr($address, 0, 7) === 'mailto:') {
+ if ('mailto:' === substr($address, 0, 7)) {
$emails[] = substr($address, 7);
}
}
+
return new Xml\Property\EmailAddressSet($emails);
});
// These two properties are shortcuts for ical to easily find
// other principals this principal has access to.
- $propRead = '{' . self::NS_CALENDARSERVER . '}calendar-proxy-read-for';
- $propWrite = '{' . self::NS_CALENDARSERVER . '}calendar-proxy-write-for';
-
- if ($propFind->getStatus($propRead) === 404 || $propFind->getStatus($propWrite) === 404) {
+ $propRead = '{'.self::NS_CALENDARSERVER.'}calendar-proxy-read-for';
+ $propWrite = '{'.self::NS_CALENDARSERVER.'}calendar-proxy-write-for';
+ if (404 === $propFind->getStatus($propRead) || 404 === $propFind->getStatus($propWrite)) {
$aclPlugin = $this->server->getPlugin('acl');
$membership = $aclPlugin->getPrincipalMembership($propFind->getPath());
$readList = [];
$writeList = [];
foreach ($membership as $group) {
-
$groupNode = $this->server->tree->getNodeForPath($group);
- $listItem = Uri\split($group)[0] . '/';
+ $listItem = Uri\split($group)[0].'/';
// If the node is either ap proxy-read or proxy-write
// group, we grab the parent principal and add it to the
@@ -394,33 +399,27 @@ class Plugin extends DAV\ServerPlugin {
if ($groupNode instanceof Principal\IProxyWrite) {
$writeList[] = $listItem;
}
-
}
$propFind->set($propRead, new LocalHref($readList));
$propFind->set($propWrite, new LocalHref($writeList));
-
}
-
} // instanceof IPrincipal
if ($node instanceof ICalendarObject) {
-
// The calendar-data property is not supposed to be a 'real'
// property, but in large chunks of the spec it does act as such.
// Therefore we simply expose it as a property.
- $propFind->handle('{' . self::NS_CALDAV . '}calendar-data', function() use ($node) {
+ $propFind->handle('{'.self::NS_CALDAV.'}calendar-data', function () use ($node) {
$val = $node->get();
- if (is_resource($val))
+ if (is_resource($val)) {
$val = stream_get_contents($val);
+ }
// Taking out \r to not screw up the xml output
- return str_replace("\r", "", $val);
-
+ return str_replace("\r", '', $val);
});
-
}
-
}
/**
@@ -430,11 +429,10 @@ class Plugin extends DAV\ServerPlugin {
* of urls. Effectively avoiding a lot of redundant requests.
*
* @param CalendarMultiGetReport $report
- * @return void
*/
- function calendarMultiGetReport($report) {
-
- $needsJson = $report->contentType === 'application/calendar+json';
+ public function calendarMultiGetReport($report)
+ {
+ $needsJson = 'application/calendar+json' === $report->contentType;
$timeZones = [];
$propertyList = [];
@@ -445,9 +443,8 @@ class Plugin extends DAV\ServerPlugin {
);
foreach ($this->server->getPropertiesForMultiplePaths($paths, $report->properties) as $uri => $objProps) {
-
- if (($needsJson || $report->expand) && isset($objProps[200]['{' . self::NS_CALDAV . '}calendar-data'])) {
- $vObject = VObject\Reader::read($objProps[200]['{' . self::NS_CALDAV . '}calendar-data']);
+ if (($needsJson || $report->expand) && isset($objProps[200]['{'.self::NS_CALDAV.'}calendar-data'])) {
+ $vObject = VObject\Reader::read($objProps[200]['{'.self::NS_CALDAV.'}calendar-data']);
if ($report->expand) {
// We're expanding, and for that we need to figure out the
@@ -455,7 +452,7 @@ class Plugin extends DAV\ServerPlugin {
list($calendarPath) = Uri\split($uri);
if (!isset($timeZones[$calendarPath])) {
// Checking the calendar-timezone property.
- $tzProp = '{' . self::NS_CALDAV . '}calendar-timezone';
+ $tzProp = '{'.self::NS_CALDAV.'}calendar-timezone';
$tzResult = $this->server->getProperties($calendarPath, [$tzProp]);
if (isset($tzResult[$tzProp])) {
// This property contains a VCALENDAR with a single
@@ -472,9 +469,9 @@ class Plugin extends DAV\ServerPlugin {
$vObject = $vObject->expand($report->expand['start'], $report->expand['end'], $timeZones[$calendarPath]);
}
if ($needsJson) {
- $objProps[200]['{' . self::NS_CALDAV . '}calendar-data'] = json_encode($vObject->jsonSerialize());
+ $objProps[200]['{'.self::NS_CALDAV.'}calendar-data'] = json_encode($vObject->jsonSerialize());
} else {
- $objProps[200]['{' . self::NS_CALDAV . '}calendar-data'] = $vObject->serialize();
+ $objProps[200]['{'.self::NS_CALDAV.'}calendar-data'] = $vObject->serialize();
}
// Destroy circular references so PHP will garbage collect the
// object.
@@ -482,7 +479,6 @@ class Plugin extends DAV\ServerPlugin {
}
$propertyList[] = $objProps;
-
}
$prefer = $this->server->getHTTPPrefer();
@@ -490,24 +486,22 @@ class Plugin extends DAV\ServerPlugin {
$this->server->httpResponse->setStatus(207);
$this->server->httpResponse->setHeader('Content-Type', 'application/xml; charset=utf-8');
$this->server->httpResponse->setHeader('Vary', 'Brief,Prefer');
- $this->server->httpResponse->setBody($this->server->generateMultiStatus($propertyList, $prefer['return'] === 'minimal'));
-
+ $this->server->httpResponse->setBody($this->server->generateMultiStatus($propertyList, 'minimal' === $prefer['return']));
}
/**
- * This function handles the calendar-query REPORT
+ * This function handles the calendar-query REPORT.
*
* This report is used by clients to request calendar objects based on
* complex conditions.
*
* @param Xml\Request\CalendarQueryReport $report
- * @return void
*/
- function calendarQueryReport($report) {
-
+ public function calendarQueryReport($report)
+ {
$path = $this->server->getRequestUri();
- $needsJson = $report->contentType === 'application/calendar+json';
+ $needsJson = 'application/calendar+json' === $report->contentType;
$node = $this->server->tree->getNodeForPath($this->server->getRequestUri());
$depth = $this->server->getHTTPDepth(0);
@@ -519,7 +513,7 @@ class Plugin extends DAV\ServerPlugin {
if ($report->expand) {
// We're expanding, and for that we need to figure out the
// calendar's timezone.
- $tzProp = '{' . self::NS_CALDAV . '}calendar-timezone';
+ $tzProp = '{'.self::NS_CALDAV.'}calendar-timezone';
$tzResult = $this->server->getProperties($path, [$tzProp]);
if (isset($tzResult[$tzProp])) {
// This property contains a VCALENDAR with a single
@@ -538,13 +532,11 @@ class Plugin extends DAV\ServerPlugin {
// The calendarobject was requested directly. In this case we handle
// this locally.
- if ($depth == 0 && $node instanceof ICalendarObject) {
-
+ if (0 == $depth && $node instanceof ICalendarObject) {
$requestedCalendarData = true;
$requestedProperties = $report->properties;
if (!in_array('{urn:ietf:params:xml:ns:caldav}calendar-data', $requestedProperties)) {
-
// We always retrieve calendar-data, as we need it for filtering.
$requestedProperties[] = '{urn:ietf:params:xml:ns:caldav}calendar-data';
@@ -566,43 +558,35 @@ class Plugin extends DAV\ServerPlugin {
// If there wasn't any calendar-data returned somehow, we ignore
// this.
if (isset($properties[200]['{urn:ietf:params:xml:ns:caldav}calendar-data'])) {
-
$validator = new CalendarQueryValidator();
$vObject = VObject\Reader::read($properties[200]['{urn:ietf:params:xml:ns:caldav}calendar-data']);
if ($validator->validate($vObject, $report->filters)) {
-
// If the client didn't require the calendar-data property,
// we won't give it back.
if (!$requestedCalendarData) {
unset($properties[200]['{urn:ietf:params:xml:ns:caldav}calendar-data']);
} else {
-
-
if ($report->expand) {
$vObject = $vObject->expand($report->expand['start'], $report->expand['end'], $calendarTimeZone);
}
if ($needsJson) {
- $properties[200]['{' . self::NS_CALDAV . '}calendar-data'] = json_encode($vObject->jsonSerialize());
+ $properties[200]['{'.self::NS_CALDAV.'}calendar-data'] = json_encode($vObject->jsonSerialize());
} elseif ($report->expand) {
- $properties[200]['{' . self::NS_CALDAV . '}calendar-data'] = $vObject->serialize();
+ $properties[200]['{'.self::NS_CALDAV.'}calendar-data'] = $vObject->serialize();
}
}
$result = [$properties];
-
}
// Destroy circular references so PHP will garbage collect the
// object.
$vObject->destroy();
-
}
-
}
- if ($node instanceof ICalendarObjectContainer && $depth === 0) {
-
- if (strpos($this->server->httpRequest->getHeader('User-Agent'), 'MSFT-') === 0) {
+ if ($node instanceof ICalendarObjectContainer && 0 === $depth) {
+ if (0 === strpos((string) $this->server->httpRequest->getHeader('User-Agent'), 'MSFT-')) {
// Microsoft clients incorrectly supplied depth as 0, when it actually
// should have set depth to 1. We're implementing a workaround here
// to deal with this.
@@ -614,31 +598,28 @@ class Plugin extends DAV\ServerPlugin {
} else {
throw new BadRequest('A calendar-query REPORT on a calendar with a Depth: 0 is undefined. Set Depth to 1');
}
-
}
// If we're dealing with a calendar, the calendar itself is responsible
// for the calendar-query.
- if ($node instanceof ICalendarObjectContainer && $depth == 1) {
-
+ if ($node instanceof ICalendarObjectContainer && 1 == $depth) {
$nodePaths = $node->calendarQuery($report->filters);
foreach ($nodePaths as $path) {
-
list($properties) =
- $this->server->getPropertiesForPath($this->server->getRequestUri() . '/' . $path, $report->properties);
+ $this->server->getPropertiesForPath($this->server->getRequestUri().'/'.$path, $report->properties);
if (($needsJson || $report->expand)) {
- $vObject = VObject\Reader::read($properties[200]['{' . self::NS_CALDAV . '}calendar-data']);
+ $vObject = VObject\Reader::read($properties[200]['{'.self::NS_CALDAV.'}calendar-data']);
if ($report->expand) {
$vObject = $vObject->expand($report->expand['start'], $report->expand['end'], $calendarTimeZone);
}
if ($needsJson) {
- $properties[200]['{' . self::NS_CALDAV . '}calendar-data'] = json_encode($vObject->jsonSerialize());
+ $properties[200]['{'.self::NS_CALDAV.'}calendar-data'] = json_encode($vObject->jsonSerialize());
} else {
- $properties[200]['{' . self::NS_CALDAV . '}calendar-data'] = $vObject->serialize();
+ $properties[200]['{'.self::NS_CALDAV.'}calendar-data'] = $vObject->serialize();
}
// Destroy circular references so PHP will garbage collect the
@@ -646,9 +627,7 @@ class Plugin extends DAV\ServerPlugin {
$vObject->destroy();
}
$result[] = $properties;
-
}
-
}
$prefer = $this->server->getHTTPPrefer();
@@ -656,8 +635,7 @@ class Plugin extends DAV\ServerPlugin {
$this->server->httpResponse->setStatus(207);
$this->server->httpResponse->setHeader('Content-Type', 'application/xml; charset=utf-8');
$this->server->httpResponse->setHeader('Vary', 'Brief,Prefer');
- $this->server->httpResponse->setBody($this->server->generateMultiStatus($result, $prefer['return'] === 'minimal'));
-
+ $this->server->httpResponse->setBody($this->server->generateMultiStatus($result, 'minimal' === $prefer['return']));
}
/**
@@ -665,15 +643,14 @@ class Plugin extends DAV\ServerPlugin {
* response for the CALDAV:free-busy-query REPORT.
*
* @param Xml\Request\FreeBusyQueryReport $report
- * @return void
*/
- protected function freeBusyQueryReport(Xml\Request\FreeBusyQueryReport $report) {
-
+ protected function freeBusyQueryReport(Xml\Request\FreeBusyQueryReport $report)
+ {
$uri = $this->server->getRequestUri();
$acl = $this->server->getPlugin('acl');
if ($acl) {
- $acl->checkPrivileges($uri, '{' . self::NS_CALDAV . '}read-free-busy');
+ $acl->checkPrivileges($uri, '{'.self::NS_CALDAV.'}read-free-busy');
}
$calendar = $this->server->tree->getNodeForPath($uri);
@@ -681,7 +658,7 @@ class Plugin extends DAV\ServerPlugin {
throw new DAV\Exception\NotImplemented('The free-busy-query REPORT is only implemented on calendars');
}
- $tzProp = '{' . self::NS_CALDAV . '}calendar-timezone';
+ $tzProp = '{'.self::NS_CALDAV.'}calendar-timezone';
// Figuring out the default timezone for the calendar, for floating
// times.
@@ -699,26 +676,27 @@ class Plugin extends DAV\ServerPlugin {
// Doing a calendar-query first, to make sure we get the most
// performance.
$urls = $calendar->calendarQuery([
- 'name' => 'VCALENDAR',
+ 'name' => 'VCALENDAR',
'comp-filters' => [
[
- 'name' => 'VEVENT',
- 'comp-filters' => [],
- 'prop-filters' => [],
+ 'name' => 'VEVENT',
+ 'comp-filters' => [],
+ 'prop-filters' => [],
'is-not-defined' => false,
- 'time-range' => [
+ 'time-range' => [
'start' => $report->start,
- 'end' => $report->end,
+ 'end' => $report->end,
],
],
],
- 'prop-filters' => [],
+ 'prop-filters' => [],
'is-not-defined' => false,
- 'time-range' => null,
+ 'time-range' => null,
]);
- $objects = array_map(function($url) use ($calendar) {
+ $objects = array_map(function ($url) use ($calendar) {
$obj = $calendar->getChild($url)->get();
+
return $obj;
}, $urls);
@@ -733,7 +711,6 @@ class Plugin extends DAV\ServerPlugin {
$this->server->httpResponse->setHeader('Content-Type', 'text/calendar');
$this->server->httpResponse->setHeader('Content-Length', strlen($result));
$this->server->httpResponse->setBody($result);
-
}
/**
@@ -742,17 +719,17 @@ class Plugin extends DAV\ServerPlugin {
* This plugin uses this method to ensure that CalDAV objects receive
* valid calendar data.
*
- * @param string $path
+ * @param string $path
* @param DAV\IFile $node
- * @param resource $data
- * @param bool $modified Should be set to true, if this event handler
- * changed &$data.
- * @return void
+ * @param resource $data
+ * @param bool $modified should be set to true, if this event handler
+ * changed &$data
*/
- function beforeWriteContent($path, DAV\IFile $node, &$data, &$modified) {
-
- if (!$node instanceof ICalendarObject)
+ public function beforeWriteContent($path, DAV\IFile $node, &$data, &$modified)
+ {
+ if (!$node instanceof ICalendarObject) {
return;
+ }
// We're onyl interested in ICalendarObject nodes that are inside of a
// real calendar. This is to avoid triggering validation and scheduling
@@ -760,8 +737,9 @@ class Plugin extends DAV\ServerPlugin {
list($parent) = Uri\split($path);
$parentNode = $this->server->tree->getNodeForPath($parent);
- if (!$parentNode instanceof ICalendar)
+ if (!$parentNode instanceof ICalendar) {
return;
+ }
$this->validateICalendar(
$data,
@@ -771,7 +749,6 @@ class Plugin extends DAV\ServerPlugin {
$this->server->httpResponse,
false
);
-
}
/**
@@ -780,17 +757,17 @@ class Plugin extends DAV\ServerPlugin {
* This plugin uses this method to ensure that newly created calendar
* objects contain valid calendar data.
*
- * @param string $path
- * @param resource $data
+ * @param string $path
+ * @param resource $data
* @param DAV\ICollection $parentNode
- * @param bool $modified Should be set to true, if this event handler
- * changed &$data.
- * @return void
+ * @param bool $modified should be set to true, if this event handler
+ * changed &$data
*/
- function beforeCreateFile($path, &$data, DAV\ICollection $parentNode, &$modified) {
-
- if (!$parentNode instanceof ICalendar)
+ public function beforeCreateFile($path, &$data, DAV\ICollection $parentNode, &$modified)
+ {
+ if (!$parentNode instanceof ICalendar) {
return;
+ }
$this->validateICalendar(
$data,
@@ -800,7 +777,6 @@ class Plugin extends DAV\ServerPlugin {
$this->server->httpResponse,
true
);
-
}
/**
@@ -808,17 +784,16 @@ class Plugin extends DAV\ServerPlugin {
*
* An exception is thrown if it's not.
*
- * @param resource|string $data
- * @param string $path
- * @param bool $modified Should be set to true, if this event handler
- * changed &$data.
- * @param RequestInterface $request The http request.
- * @param ResponseInterface $response The http response.
- * @param bool $isNew Is the item a new one, or an update.
- * @return void
+ * @param resource|string $data
+ * @param string $path
+ * @param bool $modified should be set to true, if this event handler
+ * changed &$data
+ * @param RequestInterface $request the http request
+ * @param ResponseInterface $response the http response
+ * @param bool $isNew is the item a new one, or an update
*/
- protected function validateICalendar(&$data, $path, &$modified, RequestInterface $request, ResponseInterface $response, $isNew) {
-
+ protected function validateICalendar(&$data, $path, &$modified, RequestInterface $request, ResponseInterface $response, $isNew)
+ {
// If it's a stream, we convert it to a string first.
if (is_resource($data)) {
$data = stream_get_contents($data);
@@ -827,10 +802,9 @@ class Plugin extends DAV\ServerPlugin {
$before = $data;
try {
-
// If the data starts with a [, we can reasonably assume we're dealing
// with a jCal object.
- if (substr($data, 0, 1) === '[') {
+ if ('[' === substr($data, 0, 1)) {
$vobj = VObject\Reader::readJson($data);
// Converting $data back to iCalendar, as that's what we
@@ -840,14 +814,11 @@ class Plugin extends DAV\ServerPlugin {
} else {
$vobj = VObject\Reader::read($data);
}
-
} catch (VObject\ParseException $e) {
-
- throw new DAV\Exception\UnsupportedMediaType('This resource only supports valid iCalendar 2.0 data. Parse error: ' . $e->getMessage());
-
+ throw new DAV\Exception\UnsupportedMediaType('This resource only supports valid iCalendar 2.0 data. Parse error: '.$e->getMessage());
}
- if ($vobj->name !== 'VCALENDAR') {
+ if ('VCALENDAR' !== $vobj->name) {
throw new DAV\Exception\UnsupportedMediaType('This collection can only support iCalendar objects.');
}
@@ -867,25 +838,24 @@ class Plugin extends DAV\ServerPlugin {
foreach ($vobj->getComponents() as $component) {
switch ($component->name) {
- case 'VTIMEZONE' :
+ case 'VTIMEZONE':
continue 2;
- case 'VEVENT' :
- case 'VTODO' :
- case 'VJOURNAL' :
+ case 'VEVENT':
+ case 'VTODO':
+ case 'VJOURNAL':
$foundType = $component->name;
break;
}
-
}
if (!$foundType || !in_array($foundType, $supportedComponents)) {
- throw new Exception\InvalidComponentType('iCalendar objects must at least have a component of type ' . implode(', ', $supportedComponents));
+ throw new Exception\InvalidComponentType('iCalendar objects must at least have a component of type '.implode(', ', $supportedComponents));
}
$options = VObject\Node::PROFILE_CALDAV;
$prefer = $this->server->getHTTPPrefer();
- if ($prefer['handling'] !== 'strict') {
+ if ('strict' !== $prefer['handling']) {
$options |= VObject\Node::REPAIR;
}
@@ -897,32 +867,28 @@ class Plugin extends DAV\ServerPlugin {
// $messages contains a list of problems with the vcard, along with
// their severity.
foreach ($messages as $message) {
-
if ($message['level'] > $highestLevel) {
// Recording the highest reported error level.
$highestLevel = $message['level'];
$warningMessage = $message['message'];
}
switch ($message['level']) {
-
- case 1 :
+ case 1:
// Level 1 means that there was a problem, but it was repaired.
$modified = true;
break;
- case 2 :
+ case 2:
// Level 2 means a warning, but not critical
break;
- case 3 :
+ case 3:
// Level 3 means a critical error
- throw new DAV\Exception\UnsupportedMediaType('Validation error in iCalendar: ' . $message['message']);
-
+ throw new DAV\Exception\UnsupportedMediaType('Validation error in iCalendar: '.$message['message']);
}
-
}
if ($warningMessage) {
$response->setHeader(
'X-Sabre-Ew-Gross',
- 'iCalendar validation warning: ' . $warningMessage
+ 'iCalendar validation warning: '.$warningMessage
);
}
@@ -940,7 +906,7 @@ class Plugin extends DAV\ServerPlugin {
$vobj,
$parentPath,
&$subModified,
- $isNew
+ $isNew,
]
);
@@ -949,15 +915,13 @@ class Plugin extends DAV\ServerPlugin {
$data = $vobj->serialize();
// Using md5 to figure out if there was an *actual* change.
- if (!$modified && strcmp($data, $before) !== 0) {
+ if (!$modified && 0 !== strcmp($data, $before)) {
$modified = true;
}
-
}
// Destroy circular references so PHP will garbage collect the object.
$vobj->destroy();
-
}
/**
@@ -967,11 +931,11 @@ class Plugin extends DAV\ServerPlugin {
* @param INode $node
* @param array $supportedPrivilegeSet
*/
- function getSupportedPrivilegeSet(INode $node, array &$supportedPrivilegeSet) {
-
+ public function getSupportedPrivilegeSet(INode $node, array &$supportedPrivilegeSet)
+ {
if ($node instanceof ICalendar) {
- $supportedPrivilegeSet['{DAV:}read']['aggregates']['{' . self::NS_CALDAV . '}read-free-busy'] = [
- 'abstract' => false,
+ $supportedPrivilegeSet['{DAV:}read']['aggregates']['{'.self::NS_CALDAV.'}read-free-busy'] = [
+ 'abstract' => false,
'aggregates' => [],
];
}
@@ -983,18 +947,20 @@ class Plugin extends DAV\ServerPlugin {
* can use to create new calendars.
*
* @param DAV\INode $node
- * @param string $output
+ * @param string $output
+ *
* @return bool
*/
- function htmlActionsPanel(DAV\INode $node, &$output) {
-
- if (!$node instanceof CalendarHome)
+ public function htmlActionsPanel(DAV\INode $node, &$output)
+ {
+ if (!$node instanceof CalendarHome) {
return;
+ }
$output .= '<tr><td colspan="2"><form method="post" action="">
<h3>Create new calendar</h3>
<input type="hidden" name="sabreAction" value="mkcol" />
- <input type="hidden" name="resourceType" value="{DAV:}collection,{' . self::NS_CALDAV . '}calendar" />
+ <input type="hidden" name="resourceType" value="{DAV:}collection,{'.self::NS_CALDAV.'}calendar" />
<label>Name (uri):</label> <input type="text" name="name" /><br />
<label>Display name:</label> <input type="text" name="{DAV:}displayname" /><br />
<input type="submit" value="create" />
@@ -1002,7 +968,6 @@ class Plugin extends DAV\ServerPlugin {
</td></tr>';
return false;
-
}
/**
@@ -1010,22 +975,22 @@ class Plugin extends DAV\ServerPlugin {
*
* This is used to transform data into jCal, if this was requested.
*
- * @param RequestInterface $request
+ * @param RequestInterface $request
* @param ResponseInterface $response
- * @return void
*/
- function httpAfterGet(RequestInterface $request, ResponseInterface $response) {
-
- if (strpos($response->getHeader('Content-Type'), 'text/calendar') === false) {
+ public function httpAfterGet(RequestInterface $request, ResponseInterface $response)
+ {
+ $contentType = $response->getHeader('Content-Type');
+ if (null === $contentType || false === strpos($contentType, 'text/calendar')) {
return;
}
- $result = HTTP\Util::negotiate(
+ $result = HTTP\negotiateContentType(
$request->getHeader('Accept'),
['text/calendar', 'application/calendar+json']
);
- if ($result !== 'application/calendar+json') {
+ if ('application/calendar+json' !== $result) {
// Do nothing
return;
}
@@ -1041,7 +1006,6 @@ class Plugin extends DAV\ServerPlugin {
$response->setHeader('Content-Type', 'application/calendar+json');
$response->setHeader('Content-Length', strlen($jsonBody));
-
}
/**
@@ -1055,14 +1019,12 @@ class Plugin extends DAV\ServerPlugin {
*
* @return array
*/
- function getPluginInfo() {
-
+ public function getPluginInfo()
+ {
return [
- 'name' => $this->getPluginName(),
+ 'name' => $this->getPluginName(),
'description' => 'Adds support for CalDAV (rfc4791)',
- 'link' => 'http://sabre.io/dav/caldav/',
+ 'link' => 'http://sabre.io/dav/caldav/',
];
-
}
-
}
diff --git a/vendor/sabre/dav/lib/CalDAV/Principal/Collection.php b/vendor/sabre/dav/lib/CalDAV/Principal/Collection.php
index e19719a76..cae29c752 100644
--- a/vendor/sabre/dav/lib/CalDAV/Principal/Collection.php
+++ b/vendor/sabre/dav/lib/CalDAV/Principal/Collection.php
@@ -1,11 +1,13 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CalDAV\Principal;
use Sabre\DAVACL;
/**
- * Principal collection
+ * Principal collection.
*
* This is an alternative collection to the standard ACL principal collection.
* This collection adds support for the calendar-proxy-read and
@@ -16,18 +18,17 @@ use Sabre\DAVACL;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-class Collection extends DAVACL\PrincipalCollection {
-
+class Collection extends DAVACL\PrincipalCollection
+{
/**
- * Returns a child object based on principal information
+ * Returns a child object based on principal information.
*
* @param array $principalInfo
+ *
* @return User
*/
- function getChildForPrincipal(array $principalInfo) {
-
+ public function getChildForPrincipal(array $principalInfo)
+ {
return new User($this->principalBackend, $principalInfo);
-
}
-
}
diff --git a/vendor/sabre/dav/lib/CalDAV/Principal/IProxyRead.php b/vendor/sabre/dav/lib/CalDAV/Principal/IProxyRead.php
index 7dd375932..96e6991c5 100644
--- a/vendor/sabre/dav/lib/CalDAV/Principal/IProxyRead.php
+++ b/vendor/sabre/dav/lib/CalDAV/Principal/IProxyRead.php
@@ -1,11 +1,13 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CalDAV\Principal;
use Sabre\DAVACL;
/**
- * ProxyRead principal interface
+ * ProxyRead principal interface.
*
* Any principal node implementing this interface will be picked up as a 'proxy
* principal group'.
@@ -14,6 +16,6 @@ use Sabre\DAVACL;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-interface IProxyRead extends DAVACL\IPrincipal {
-
+interface IProxyRead extends DAVACL\IPrincipal
+{
}
diff --git a/vendor/sabre/dav/lib/CalDAV/Principal/IProxyWrite.php b/vendor/sabre/dav/lib/CalDAV/Principal/IProxyWrite.php
index eda87a4ff..2556039ca 100644
--- a/vendor/sabre/dav/lib/CalDAV/Principal/IProxyWrite.php
+++ b/vendor/sabre/dav/lib/CalDAV/Principal/IProxyWrite.php
@@ -1,11 +1,13 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CalDAV\Principal;
use Sabre\DAVACL;
/**
- * ProxyWrite principal interface
+ * ProxyWrite principal interface.
*
* Any principal node implementing this interface will be picked up as a 'proxy
* principal group'.
@@ -14,6 +16,6 @@ use Sabre\DAVACL;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-interface IProxyWrite extends DAVACL\IPrincipal {
-
+interface IProxyWrite extends DAVACL\IPrincipal
+{
}
diff --git a/vendor/sabre/dav/lib/CalDAV/Principal/ProxyRead.php b/vendor/sabre/dav/lib/CalDAV/Principal/ProxyRead.php
index e3881831e..1b24984bd 100644
--- a/vendor/sabre/dav/lib/CalDAV/Principal/ProxyRead.php
+++ b/vendor/sabre/dav/lib/CalDAV/Principal/ProxyRead.php
@@ -1,12 +1,14 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CalDAV\Principal;
use Sabre\DAV;
use Sabre\DAVACL;
/**
- * ProxyRead principal
+ * ProxyRead principal.
*
* This class represents a principal group, hosted under the main principal.
* This is needed to implement 'Calendar delegation' support. This class is
@@ -16,8 +18,8 @@ use Sabre\DAVACL;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-class ProxyRead implements IProxyRead {
-
+class ProxyRead implements IProxyRead
+{
/**
* Principal information from the parent principal.
*
@@ -26,7 +28,7 @@ class ProxyRead implements IProxyRead {
protected $principalInfo;
/**
- * Principal backend
+ * Principal backend.
*
* @var DAVACL\PrincipalBackend\BackendInterface
*/
@@ -38,13 +40,12 @@ class ProxyRead implements IProxyRead {
* Note that you MUST supply the parent principal information.
*
* @param DAVACL\PrincipalBackend\BackendInterface $principalBackend
- * @param array $principalInfo
+ * @param array $principalInfo
*/
- function __construct(DAVACL\PrincipalBackend\BackendInterface $principalBackend, array $principalInfo) {
-
+ public function __construct(DAVACL\PrincipalBackend\BackendInterface $principalBackend, array $principalInfo)
+ {
$this->principalInfo = $principalInfo;
$this->principalBackend = $principalBackend;
-
}
/**
@@ -52,103 +53,91 @@ class ProxyRead implements IProxyRead {
*
* @return string
*/
- function getName() {
-
+ public function getName()
+ {
return 'calendar-proxy-read';
-
}
/**
- * Returns the last modification time
- *
- * @return null
+ * Returns the last modification time.
*/
- function getLastModified() {
-
+ public function getLastModified()
+ {
return null;
-
}
/**
- * Deletes the current node
+ * Deletes the current node.
*
* @throws DAV\Exception\Forbidden
- * @return void
*/
- function delete() {
-
+ public function delete()
+ {
throw new DAV\Exception\Forbidden('Permission denied to delete node');
-
}
/**
- * Renames the node
+ * Renames the node.
*
* @param string $name The new name
+ *
* @throws DAV\Exception\Forbidden
- * @return void
*/
- function setName($name) {
-
+ public function setName($name)
+ {
throw new DAV\Exception\Forbidden('Permission denied to rename file');
-
}
-
/**
- * Returns a list of alternative urls for a principal
+ * Returns a list of alternative urls for a principal.
*
* This can for example be an email address, or ldap url.
*
* @return array
*/
- function getAlternateUriSet() {
-
+ public function getAlternateUriSet()
+ {
return [];
-
}
/**
- * Returns the full principal url
+ * Returns the full principal url.
*
* @return string
*/
- function getPrincipalUrl() {
-
- return $this->principalInfo['uri'] . '/' . $this->getName();
-
+ public function getPrincipalUrl()
+ {
+ return $this->principalInfo['uri'].'/'.$this->getName();
}
/**
- * Returns the list of group members
+ * Returns the list of group members.
*
* If this principal is a group, this function should return
* all member principal uri's for the group.
*
* @return array
*/
- function getGroupMemberSet() {
-
+ public function getGroupMemberSet()
+ {
return $this->principalBackend->getGroupMemberSet($this->getPrincipalUrl());
-
}
/**
- * Returns the list of groups this principal is member of
+ * Returns the list of groups this principal is member of.
*
* If this principal is a member of a (list of) groups, this function
* should return a list of principal uri's for it's members.
*
* @return array
*/
- function getGroupMembership() {
-
+ public function getGroupMembership()
+ {
return $this->principalBackend->getGroupMembership($this->getPrincipalUrl());
-
}
/**
- * Sets a list of group members
+ * Sets a list of group members.
*
* If this principal is a group, this method sets all the group members.
* The list of members is always overwritten, never appended to.
@@ -156,26 +145,22 @@ class ProxyRead implements IProxyRead {
* This method should throw an exception if the members could not be set.
*
* @param array $principals
- * @return void
*/
- function setGroupMemberSet(array $principals) {
-
+ public function setGroupMemberSet(array $principals)
+ {
$this->principalBackend->setGroupMemberSet($this->getPrincipalUrl(), $principals);
-
}
/**
- * Returns the displayname
+ * Returns the displayname.
*
* This should be a human readable name for the principal.
* If none is available, return the nodename.
*
* @return string
*/
- function getDisplayName() {
-
+ public function getDisplayName()
+ {
return $this->getName();
-
}
-
}
diff --git a/vendor/sabre/dav/lib/CalDAV/Principal/ProxyWrite.php b/vendor/sabre/dav/lib/CalDAV/Principal/ProxyWrite.php
index 43dd9bf07..7b9c78e0a 100644
--- a/vendor/sabre/dav/lib/CalDAV/Principal/ProxyWrite.php
+++ b/vendor/sabre/dav/lib/CalDAV/Principal/ProxyWrite.php
@@ -1,12 +1,14 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CalDAV\Principal;
use Sabre\DAV;
use Sabre\DAVACL;
/**
- * ProxyWrite principal
+ * ProxyWrite principal.
*
* This class represents a principal group, hosted under the main principal.
* This is needed to implement 'Calendar delegation' support. This class is
@@ -16,35 +18,34 @@ use Sabre\DAVACL;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-class ProxyWrite implements IProxyWrite {
-
+class ProxyWrite implements IProxyWrite
+{
/**
- * Parent principal information
+ * Parent principal information.
*
* @var array
*/
protected $principalInfo;
/**
- * Principal Backend
+ * Principal Backend.
*
* @var DAVACL\PrincipalBackend\BackendInterface
*/
protected $principalBackend;
/**
- * Creates the object
+ * Creates the object.
*
* Note that you MUST supply the parent principal information.
*
* @param DAVACL\PrincipalBackend\BackendInterface $principalBackend
- * @param array $principalInfo
+ * @param array $principalInfo
*/
- function __construct(DAVACL\PrincipalBackend\BackendInterface $principalBackend, array $principalInfo) {
-
+ public function __construct(DAVACL\PrincipalBackend\BackendInterface $principalBackend, array $principalInfo)
+ {
$this->principalInfo = $principalInfo;
$this->principalBackend = $principalBackend;
-
}
/**
@@ -52,103 +53,91 @@ class ProxyWrite implements IProxyWrite {
*
* @return string
*/
- function getName() {
-
+ public function getName()
+ {
return 'calendar-proxy-write';
-
}
/**
- * Returns the last modification time
- *
- * @return null
+ * Returns the last modification time.
*/
- function getLastModified() {
-
+ public function getLastModified()
+ {
return null;
-
}
/**
- * Deletes the current node
+ * Deletes the current node.
*
* @throws DAV\Exception\Forbidden
- * @return void
*/
- function delete() {
-
+ public function delete()
+ {
throw new DAV\Exception\Forbidden('Permission denied to delete node');
-
}
/**
- * Renames the node
+ * Renames the node.
*
* @param string $name The new name
+ *
* @throws DAV\Exception\Forbidden
- * @return void
*/
- function setName($name) {
-
+ public function setName($name)
+ {
throw new DAV\Exception\Forbidden('Permission denied to rename file');
-
}
-
/**
- * Returns a list of alternative urls for a principal
+ * Returns a list of alternative urls for a principal.
*
* This can for example be an email address, or ldap url.
*
* @return array
*/
- function getAlternateUriSet() {
-
+ public function getAlternateUriSet()
+ {
return [];
-
}
/**
- * Returns the full principal url
+ * Returns the full principal url.
*
* @return string
*/
- function getPrincipalUrl() {
-
- return $this->principalInfo['uri'] . '/' . $this->getName();
-
+ public function getPrincipalUrl()
+ {
+ return $this->principalInfo['uri'].'/'.$this->getName();
}
/**
- * Returns the list of group members
+ * Returns the list of group members.
*
* If this principal is a group, this function should return
* all member principal uri's for the group.
*
* @return array
*/
- function getGroupMemberSet() {
-
+ public function getGroupMemberSet()
+ {
return $this->principalBackend->getGroupMemberSet($this->getPrincipalUrl());
-
}
/**
- * Returns the list of groups this principal is member of
+ * Returns the list of groups this principal is member of.
*
* If this principal is a member of a (list of) groups, this function
* should return a list of principal uri's for it's members.
*
* @return array
*/
- function getGroupMembership() {
-
+ public function getGroupMembership()
+ {
return $this->principalBackend->getGroupMembership($this->getPrincipalUrl());
-
}
/**
- * Sets a list of group members
+ * Sets a list of group members.
*
* If this principal is a group, this method sets all the group members.
* The list of members is always overwritten, never appended to.
@@ -156,26 +145,22 @@ class ProxyWrite implements IProxyWrite {
* This method should throw an exception if the members could not be set.
*
* @param array $principals
- * @return void
*/
- function setGroupMemberSet(array $principals) {
-
+ public function setGroupMemberSet(array $principals)
+ {
$this->principalBackend->setGroupMemberSet($this->getPrincipalUrl(), $principals);
-
}
/**
- * Returns the displayname
+ * Returns the displayname.
*
* This should be a human readable name for the principal.
* If none is available, return the nodename.
*
* @return string
*/
- function getDisplayName() {
-
+ public function getDisplayName()
+ {
return $this->getName();
-
}
-
}
diff --git a/vendor/sabre/dav/lib/CalDAV/Principal/User.php b/vendor/sabre/dav/lib/CalDAV/Principal/User.php
index 6e97e7cca..88bf4b4f7 100644
--- a/vendor/sabre/dav/lib/CalDAV/Principal/User.php
+++ b/vendor/sabre/dav/lib/CalDAV/Principal/User.php
@@ -1,12 +1,14 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CalDAV\Principal;
use Sabre\DAV;
use Sabre\DAVACL;
/**
- * CalDAV principal
+ * CalDAV principal.
*
* This is a standard user-principal for CalDAV. This principal is also a
* collection and returns the caldav-proxy-read and caldav-proxy-write child
@@ -16,91 +18,91 @@ use Sabre\DAVACL;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-class User extends DAVACL\Principal implements DAV\ICollection {
-
+class User extends DAVACL\Principal implements DAV\ICollection
+{
/**
- * Creates a new file in the directory
+ * Creates a new file in the directory.
+ *
+ * @param string $name Name of the file
+ * @param resource $data initial payload, passed as a readable stream resource
*
- * @param string $name Name of the file
- * @param resource $data Initial payload, passed as a readable stream resource.
* @throws DAV\Exception\Forbidden
- * @return void
*/
- function createFile($name, $data = null) {
-
- throw new DAV\Exception\Forbidden('Permission denied to create file (filename ' . $name . ')');
-
+ public function createFile($name, $data = null)
+ {
+ throw new DAV\Exception\Forbidden('Permission denied to create file (filename '.$name.')');
}
/**
- * Creates a new subdirectory
+ * Creates a new subdirectory.
*
* @param string $name
+ *
* @throws DAV\Exception\Forbidden
- * @return void
*/
- function createDirectory($name) {
-
+ public function createDirectory($name)
+ {
throw new DAV\Exception\Forbidden('Permission denied to create directory');
-
}
/**
- * Returns a specific child node, referenced by its name
+ * Returns a specific child node, referenced by its name.
*
* @param string $name
+ *
* @return DAV\INode
*/
- function getChild($name) {
-
- $principal = $this->principalBackend->getPrincipalByPath($this->getPrincipalURL() . '/' . $name);
+ public function getChild($name)
+ {
+ $principal = $this->principalBackend->getPrincipalByPath($this->getPrincipalURL().'/'.$name);
if (!$principal) {
- throw new DAV\Exception\NotFound('Node with name ' . $name . ' was not found');
+ throw new DAV\Exception\NotFound('Node with name '.$name.' was not found');
}
- if ($name === 'calendar-proxy-read')
+ if ('calendar-proxy-read' === $name) {
return new ProxyRead($this->principalBackend, $this->principalProperties);
+ }
- if ($name === 'calendar-proxy-write')
+ if ('calendar-proxy-write' === $name) {
return new ProxyWrite($this->principalBackend, $this->principalProperties);
+ }
- throw new DAV\Exception\NotFound('Node with name ' . $name . ' was not found');
-
+ throw new DAV\Exception\NotFound('Node with name '.$name.' was not found');
}
/**
- * Returns an array with all the child nodes
+ * Returns an array with all the child nodes.
*
* @return DAV\INode[]
*/
- function getChildren() {
-
+ public function getChildren()
+ {
$r = [];
- if ($this->principalBackend->getPrincipalByPath($this->getPrincipalURL() . '/calendar-proxy-read')) {
+ if ($this->principalBackend->getPrincipalByPath($this->getPrincipalURL().'/calendar-proxy-read')) {
$r[] = new ProxyRead($this->principalBackend, $this->principalProperties);
}
- if ($this->principalBackend->getPrincipalByPath($this->getPrincipalURL() . '/calendar-proxy-write')) {
+ if ($this->principalBackend->getPrincipalByPath($this->getPrincipalURL().'/calendar-proxy-write')) {
$r[] = new ProxyWrite($this->principalBackend, $this->principalProperties);
}
return $r;
-
}
/**
- * Returns whether or not the child node exists
+ * Returns whether or not the child node exists.
*
* @param string $name
+ *
* @return bool
*/
- function childExists($name) {
-
+ public function childExists($name)
+ {
try {
$this->getChild($name);
+
return true;
} catch (DAV\Exception\NotFound $e) {
return false;
}
-
}
/**
@@ -115,21 +117,20 @@ class User extends DAVACL\Principal implements DAV\ICollection {
*
* @return array
*/
- function getACL() {
-
+ public function getACL()
+ {
$acl = parent::getACL();
$acl[] = [
'privilege' => '{DAV:}read',
- 'principal' => $this->principalProperties['uri'] . '/calendar-proxy-read',
+ 'principal' => $this->principalProperties['uri'].'/calendar-proxy-read',
'protected' => true,
];
$acl[] = [
'privilege' => '{DAV:}read',
- 'principal' => $this->principalProperties['uri'] . '/calendar-proxy-write',
+ 'principal' => $this->principalProperties['uri'].'/calendar-proxy-write',
'protected' => true,
];
- return $acl;
+ return $acl;
}
-
}
diff --git a/vendor/sabre/dav/lib/CalDAV/Schedule/IInbox.php b/vendor/sabre/dav/lib/CalDAV/Schedule/IInbox.php
index c9fd77d93..64a94becc 100644
--- a/vendor/sabre/dav/lib/CalDAV/Schedule/IInbox.php
+++ b/vendor/sabre/dav/lib/CalDAV/Schedule/IInbox.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CalDAV\Schedule;
/**
@@ -10,6 +12,6 @@ namespace Sabre\CalDAV\Schedule;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-interface IInbox extends \Sabre\CalDAV\ICalendarObjectContainer, \Sabre\DAVACL\IACL {
-
+interface IInbox extends \Sabre\CalDAV\ICalendarObjectContainer, \Sabre\DAVACL\IACL
+{
}
diff --git a/vendor/sabre/dav/lib/CalDAV/Schedule/IMipPlugin.php b/vendor/sabre/dav/lib/CalDAV/Schedule/IMipPlugin.php
index 6f5acb29a..d71b3c0f8 100644
--- a/vendor/sabre/dav/lib/CalDAV/Schedule/IMipPlugin.php
+++ b/vendor/sabre/dav/lib/CalDAV/Schedule/IMipPlugin.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CalDAV\Schedule;
use Sabre\DAV;
@@ -19,8 +21,8 @@ use Sabre\VObject\ITip;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-class IMipPlugin extends DAV\ServerPlugin {
-
+class IMipPlugin extends DAV\ServerPlugin
+{
/**
* Email address used in From: header.
*
@@ -29,7 +31,7 @@ class IMipPlugin extends DAV\ServerPlugin {
protected $senderEmail;
/**
- * ITipMessage
+ * ITipMessage.
*
* @var ITip\Message
*/
@@ -43,10 +45,9 @@ class IMipPlugin extends DAV\ServerPlugin {
* generally be some kind of no-reply email
* address you own.
*/
- function __construct($senderEmail) {
-
+ public function __construct($senderEmail)
+ {
$this->senderEmail = $senderEmail;
-
}
/*
@@ -60,10 +61,9 @@ class IMipPlugin extends DAV\ServerPlugin {
* @param DAV\Server $server
* @return void
*/
- function initialize(DAV\Server $server) {
-
+ public function initialize(DAV\Server $server)
+ {
$server->on('schedule', [$this, 'schedule'], 120);
-
}
/**
@@ -74,67 +74,68 @@ class IMipPlugin extends DAV\ServerPlugin {
*
* @return string
*/
- function getPluginName() {
-
+ public function getPluginName()
+ {
return 'imip';
-
}
/**
* Event handler for the 'schedule' event.
*
* @param ITip\Message $iTipMessage
- * @return void
*/
- function schedule(ITip\Message $iTipMessage) {
-
+ public function schedule(ITip\Message $iTipMessage)
+ {
// Not sending any emails if the system considers the update
// insignificant.
if (!$iTipMessage->significantChange) {
if (!$iTipMessage->scheduleStatus) {
$iTipMessage->scheduleStatus = '1.0;We got the message, but it\'s not significant enough to warrant an email';
}
+
return;
}
$summary = $iTipMessage->message->VEVENT->SUMMARY;
- if (parse_url($iTipMessage->sender, PHP_URL_SCHEME) !== 'mailto')
+ if ('mailto' !== parse_url($iTipMessage->sender, PHP_URL_SCHEME)) {
return;
+ }
- if (parse_url($iTipMessage->recipient, PHP_URL_SCHEME) !== 'mailto')
+ if ('mailto' !== parse_url($iTipMessage->recipient, PHP_URL_SCHEME)) {
return;
+ }
$sender = substr($iTipMessage->sender, 7);
$recipient = substr($iTipMessage->recipient, 7);
if ($iTipMessage->senderName) {
- $sender = $iTipMessage->senderName . ' <' . $sender . '>';
+ $sender = $iTipMessage->senderName.' <'.$sender.'>';
}
- if ($iTipMessage->recipientName) {
- $recipient = $iTipMessage->recipientName . ' <' . $recipient . '>';
+ if ($iTipMessage->recipientName && $iTipMessage->recipientName != $recipient) {
+ $recipient = $iTipMessage->recipientName.' <'.$recipient.'>';
}
$subject = 'SabreDAV iTIP message';
switch (strtoupper($iTipMessage->method)) {
- case 'REPLY' :
- $subject = 'Re: ' . $summary;
+ case 'REPLY':
+ $subject = 'Re: '.$summary;
break;
- case 'REQUEST' :
- $subject = $summary;
+ case 'REQUEST':
+ $subject = 'Invitation: '.$summary;
break;
- case 'CANCEL' :
- $subject = 'Cancelled: ' . $summary;
+ case 'CANCEL':
+ $subject = 'Cancelled: '.$summary;
break;
}
$headers = [
- 'Reply-To: ' . $sender,
- 'From: ' . $this->senderEmail,
- 'Content-Type: text/calendar; charset=UTF-8; method=' . $iTipMessage->method,
+ 'Reply-To: '.$sender,
+ 'From: '.$iTipMessage->senderName.' <'.$this->senderEmail.'>',
+ 'Content-Type: text/calendar; charset=UTF-8; method='.$iTipMessage->method,
];
if (DAV\Server::$exposeVersion) {
- $headers[] = 'X-Sabre-Version: ' . DAV\Version::VERSION;
+ $headers[] = 'X-Sabre-Version: '.DAV\Version::VERSION;
}
$this->mail(
$recipient,
@@ -143,7 +144,6 @@ class IMipPlugin extends DAV\ServerPlugin {
$headers
);
$iTipMessage->scheduleStatus = '1.1; Scheduling message is sent via iMip';
-
}
// @codeCoverageIgnoreStart
@@ -152,16 +152,14 @@ class IMipPlugin extends DAV\ServerPlugin {
/**
* This function is responsible for sending the actual email.
*
- * @param string $to Recipient email address
+ * @param string $to Recipient email address
* @param string $subject Subject of the email
- * @param string $body iCalendar body
- * @param array $headers List of headers
- * @return void
+ * @param string $body iCalendar body
+ * @param array $headers List of headers
*/
- protected function mail($to, $subject, $body, array $headers) {
-
+ protected function mail($to, $subject, $body, array $headers)
+ {
mail($to, $subject, $body, implode("\r\n", $headers));
-
}
// @codeCoverageIgnoreEnd
@@ -177,14 +175,12 @@ class IMipPlugin extends DAV\ServerPlugin {
*
* @return array
*/
- function getPluginInfo() {
-
+ public function getPluginInfo()
+ {
return [
- 'name' => $this->getPluginName(),
+ 'name' => $this->getPluginName(),
'description' => 'Email delivery (rfc6047) for CalDAV scheduling',
- 'link' => 'http://sabre.io/dav/scheduling/',
+ 'link' => 'http://sabre.io/dav/scheduling/',
];
-
}
-
}
diff --git a/vendor/sabre/dav/lib/CalDAV/Schedule/IOutbox.php b/vendor/sabre/dav/lib/CalDAV/Schedule/IOutbox.php
index 88fbdc411..384b503df 100644
--- a/vendor/sabre/dav/lib/CalDAV/Schedule/IOutbox.php
+++ b/vendor/sabre/dav/lib/CalDAV/Schedule/IOutbox.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CalDAV\Schedule;
/**
@@ -10,6 +12,6 @@ namespace Sabre\CalDAV\Schedule;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-interface IOutbox extends \Sabre\DAV\ICollection, \Sabre\DAVACL\IACL {
-
+interface IOutbox extends \Sabre\DAV\ICollection, \Sabre\DAVACL\IACL
+{
}
diff --git a/vendor/sabre/dav/lib/CalDAV/Schedule/ISchedulingObject.php b/vendor/sabre/dav/lib/CalDAV/Schedule/ISchedulingObject.php
index b37cb40a1..345b55d9f 100644
--- a/vendor/sabre/dav/lib/CalDAV/Schedule/ISchedulingObject.php
+++ b/vendor/sabre/dav/lib/CalDAV/Schedule/ISchedulingObject.php
@@ -1,13 +1,15 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CalDAV\Schedule;
/**
- * The SchedulingObject represents a scheduling object in the Inbox collection
+ * The SchedulingObject represents a scheduling object in the Inbox collection.
*
* @license http://sabre.io/license/ Modified BSD License
* @copyright Copyright (C) fruux GmbH (https://fruux.com/)
*/
-interface ISchedulingObject extends \Sabre\CalDAV\ICalendarObject {
-
+interface ISchedulingObject extends \Sabre\CalDAV\ICalendarObject
+{
}
diff --git a/vendor/sabre/dav/lib/CalDAV/Schedule/Inbox.php b/vendor/sabre/dav/lib/CalDAV/Schedule/Inbox.php
index 81b017307..d92f1dd4c 100644
--- a/vendor/sabre/dav/lib/CalDAV/Schedule/Inbox.php
+++ b/vendor/sabre/dav/lib/CalDAV/Schedule/Inbox.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CalDAV\Schedule;
use Sabre\CalDAV;
@@ -9,41 +11,40 @@ use Sabre\DAVACL;
use Sabre\VObject;
/**
- * The CalDAV scheduling inbox
+ * The CalDAV scheduling inbox.
*
* @copyright Copyright (C) fruux GmbH (https://fruux.com/)
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-class Inbox extends DAV\Collection implements IInbox {
-
+class Inbox extends DAV\Collection implements IInbox
+{
use DAVACL\ACLTrait;
/**
- * CalDAV backend
+ * CalDAV backend.
*
* @var Backend\BackendInterface
*/
protected $caldavBackend;
/**
- * The principal Uri
+ * The principal Uri.
*
* @var string
*/
protected $principalUri;
/**
- * Constructor
+ * Constructor.
*
* @param Backend\SchedulingSupport $caldavBackend
- * @param string $principalUri
+ * @param string $principalUri
*/
- function __construct(Backend\SchedulingSupport $caldavBackend, $principalUri) {
-
+ public function __construct(Backend\SchedulingSupport $caldavBackend, $principalUri)
+ {
$this->caldavBackend = $caldavBackend;
$this->principalUri = $principalUri;
-
}
/**
@@ -53,19 +54,18 @@ class Inbox extends DAV\Collection implements IInbox {
*
* @return string
*/
- function getName() {
-
+ public function getName()
+ {
return 'inbox';
-
}
/**
- * Returns an array with all the child nodes
+ * Returns an array with all the child nodes.
*
* @return \Sabre\DAV\INode[]
*/
- function getChildren() {
-
+ public function getChildren()
+ {
$objs = $this->caldavBackend->getSchedulingObjects($this->principalUri);
$children = [];
foreach ($objs as $obj) {
@@ -73,12 +73,12 @@ class Inbox extends DAV\Collection implements IInbox {
$obj['principaluri'] = $this->principalUri;
$children[] = new SchedulingObject($this->caldavBackend, $obj);
}
- return $children;
+ return $children;
}
/**
- * Creates a new file in the directory
+ * Creates a new file in the directory.
*
* Data will either be supplied as a stream resource, or in certain cases
* as a string. Keep in mind that you may have to support either.
@@ -97,27 +97,26 @@ class Inbox extends DAV\Collection implements IInbox {
* return the same contents of what was submitted here, you are strongly
* recommended to omit the ETag.
*
- * @param string $name Name of the file
+ * @param string $name Name of the file
* @param resource|string $data Initial payload
- * @return null|string
+ *
+ * @return string|null
*/
- function createFile($name, $data = null) {
-
+ public function createFile($name, $data = null)
+ {
$this->caldavBackend->createSchedulingObject($this->principalUri, $name, $data);
-
}
/**
- * Returns the owner principal
+ * Returns the owner principal.
*
* This must be a url to a principal, or null if there's no owner
*
* @return string|null
*/
- function getOwner() {
-
+ public function getOwner()
+ {
return $this->principalUri;
-
}
/**
@@ -132,8 +131,8 @@ class Inbox extends DAV\Collection implements IInbox {
*
* @return array
*/
- function getACL() {
-
+ public function getACL()
+ {
return [
[
'privilege' => '{DAV:}read',
@@ -152,16 +151,15 @@ class Inbox extends DAV\Collection implements IInbox {
],
[
'privilege' => '{DAV:}unbind',
- 'principal' => $this->getOwner() . '/calendar-proxy-write',
+ 'principal' => $this->getOwner().'/calendar-proxy-write',
'protected' => true,
],
[
- 'privilege' => '{' . CalDAV\Plugin::NS_CALDAV . '}schedule-deliver',
+ 'privilege' => '{'.CalDAV\Plugin::NS_CALDAV.'}schedule-deliver',
'principal' => '{DAV:}authenticated',
'protected' => true,
],
];
-
}
/**
@@ -179,10 +177,11 @@ class Inbox extends DAV\Collection implements IInbox {
* documented by \Sabre\CalDAV\CalendarQueryParser.
*
* @param array $filters
+ *
* @return array
*/
- function calendarQuery(array $filters) {
-
+ public function calendarQuery(array $filters)
+ {
$result = [];
$validator = new CalDAV\CalendarQueryValidator();
@@ -196,8 +195,7 @@ class Inbox extends DAV\Collection implements IInbox {
// Destroy circular references to PHP will GC the object.
$vObject->destroy();
}
- return $result;
+ return $result;
}
-
}
diff --git a/vendor/sabre/dav/lib/CalDAV/Schedule/Outbox.php b/vendor/sabre/dav/lib/CalDAV/Schedule/Outbox.php
index 888ea3086..1442c4cc6 100644
--- a/vendor/sabre/dav/lib/CalDAV/Schedule/Outbox.php
+++ b/vendor/sabre/dav/lib/CalDAV/Schedule/Outbox.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CalDAV\Schedule;
use Sabre\CalDAV;
@@ -7,7 +9,7 @@ use Sabre\DAV;
use Sabre\DAVACL;
/**
- * The CalDAV scheduling outbox
+ * The CalDAV scheduling outbox.
*
* The outbox is mainly used as an endpoint in the tree for a client to do
* free-busy requests. This functionality is completely handled by the
@@ -17,26 +19,25 @@ use Sabre\DAVACL;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-class Outbox extends DAV\Collection implements IOutbox {
-
+class Outbox extends DAV\Collection implements IOutbox
+{
use DAVACL\ACLTrait;
/**
- * The principal Uri
+ * The principal Uri.
*
* @var string
*/
protected $principalUri;
/**
- * Constructor
+ * Constructor.
*
* @param string $principalUri
*/
- function __construct($principalUri) {
-
+ public function __construct($principalUri)
+ {
$this->principalUri = $principalUri;
-
}
/**
@@ -46,34 +47,31 @@ class Outbox extends DAV\Collection implements IOutbox {
*
* @return string
*/
- function getName() {
-
+ public function getName()
+ {
return 'outbox';
-
}
/**
- * Returns an array with all the child nodes
+ * Returns an array with all the child nodes.
*
* @return \Sabre\DAV\INode[]
*/
- function getChildren() {
-
+ public function getChildren()
+ {
return [];
-
}
/**
- * Returns the owner principal
+ * Returns the owner principal.
*
* This must be a url to a principal, or null if there's no owner
*
* @return string|null
*/
- function getOwner() {
-
+ public function getOwner()
+ {
return $this->principalUri;
-
}
/**
@@ -88,11 +86,11 @@ class Outbox extends DAV\Collection implements IOutbox {
*
* @return array
*/
- function getACL() {
-
+ public function getACL()
+ {
return [
[
- 'privilege' => '{' . CalDAV\Plugin::NS_CALDAV . '}schedule-send',
+ 'privilege' => '{'.CalDAV\Plugin::NS_CALDAV.'}schedule-send',
'principal' => $this->getOwner(),
'protected' => true,
],
@@ -102,22 +100,20 @@ class Outbox extends DAV\Collection implements IOutbox {
'protected' => true,
],
[
- 'privilege' => '{' . CalDAV\Plugin::NS_CALDAV . '}schedule-send',
- 'principal' => $this->getOwner() . '/calendar-proxy-write',
+ 'privilege' => '{'.CalDAV\Plugin::NS_CALDAV.'}schedule-send',
+ 'principal' => $this->getOwner().'/calendar-proxy-write',
'protected' => true,
],
[
'privilege' => '{DAV:}read',
- 'principal' => $this->getOwner() . '/calendar-proxy-read',
+ 'principal' => $this->getOwner().'/calendar-proxy-read',
'protected' => true,
],
[
'privilege' => '{DAV:}read',
- 'principal' => $this->getOwner() . '/calendar-proxy-write',
+ 'principal' => $this->getOwner().'/calendar-proxy-write',
'protected' => true,
],
];
-
}
-
}
diff --git a/vendor/sabre/dav/lib/CalDAV/Schedule/Plugin.php b/vendor/sabre/dav/lib/CalDAV/Schedule/Plugin.php
index 0b991e619..d2c9b68e9 100644
--- a/vendor/sabre/dav/lib/CalDAV/Schedule/Plugin.php
+++ b/vendor/sabre/dav/lib/CalDAV/Schedule/Plugin.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CalDAV\Schedule;
use DateTimeZone;
@@ -28,7 +30,7 @@ use Sabre\VObject\Reader;
/**
* CalDAV scheduling plugin.
- * =========================
+ * =========================.
*
* This plugin provides the functionality added by the "Scheduling Extensions
* to CalDAV" standard, as defined in RFC6638.
@@ -53,10 +55,10 @@ use Sabre\VObject\Reader;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-class Plugin extends ServerPlugin {
-
+class Plugin extends ServerPlugin
+{
/**
- * This is the official CalDAV namespace
+ * This is the official CalDAV namespace.
*/
const NS_CALDAV = 'urn:ietf:params:xml:ns:caldav';
@@ -72,10 +74,9 @@ class Plugin extends ServerPlugin {
*
* @return array
*/
- function getFeatures() {
-
+ public function getFeatures()
+ {
return ['calendar-auto-schedule', 'calendar-availability'];
-
}
/**
@@ -86,49 +87,46 @@ class Plugin extends ServerPlugin {
*
* @return string
*/
- function getPluginName() {
-
+ public function getPluginName()
+ {
return 'caldav-schedule';
-
}
/**
- * Initializes the plugin
+ * Initializes the plugin.
*
* @param Server $server
- * @return void
*/
- function initialize(Server $server) {
-
+ public function initialize(Server $server)
+ {
$this->server = $server;
- $server->on('method:POST', [$this, 'httpPost']);
- $server->on('propFind', [$this, 'propFind']);
- $server->on('propPatch', [$this, 'propPatch']);
- $server->on('calendarObjectChange', [$this, 'calendarObjectChange']);
- $server->on('beforeUnbind', [$this, 'beforeUnbind']);
- $server->on('schedule', [$this, 'scheduleLocalDelivery']);
+ $server->on('method:POST', [$this, 'httpPost']);
+ $server->on('propFind', [$this, 'propFind']);
+ $server->on('propPatch', [$this, 'propPatch']);
+ $server->on('calendarObjectChange', [$this, 'calendarObjectChange']);
+ $server->on('beforeUnbind', [$this, 'beforeUnbind']);
+ $server->on('schedule', [$this, 'scheduleLocalDelivery']);
$server->on('getSupportedPrivilegeSet', [$this, 'getSupportedPrivilegeSet']);
- $ns = '{' . self::NS_CALDAV . '}';
+ $ns = '{'.self::NS_CALDAV.'}';
- /**
+ /*
* This information ensures that the {DAV:}resourcetype property has
* the correct values.
*/
- $server->resourceTypeMapping['\\Sabre\\CalDAV\\Schedule\\IOutbox'] = $ns . 'schedule-outbox';
- $server->resourceTypeMapping['\\Sabre\\CalDAV\\Schedule\\IInbox'] = $ns . 'schedule-inbox';
+ $server->resourceTypeMapping['\\Sabre\\CalDAV\\Schedule\\IOutbox'] = $ns.'schedule-outbox';
+ $server->resourceTypeMapping['\\Sabre\\CalDAV\\Schedule\\IInbox'] = $ns.'schedule-inbox';
- /**
+ /*
* Properties we protect are made read-only by the server.
*/
array_push($server->protectedProperties,
- $ns . 'schedule-inbox-URL',
- $ns . 'schedule-outbox-URL',
- $ns . 'calendar-user-address-set',
- $ns . 'calendar-user-type',
- $ns . 'schedule-default-calendar-URL'
+ $ns.'schedule-inbox-URL',
+ $ns.'schedule-outbox-URL',
+ $ns.'calendar-user-address-set',
+ $ns.'calendar-user-type',
+ $ns.'schedule-default-calendar-URL'
);
-
}
/**
@@ -139,10 +137,11 @@ class Plugin extends ServerPlugin {
* available for the specified uri.
*
* @param string $uri
+ *
* @return array
*/
- function getHTTPMethods($uri) {
-
+ public function getHTTPMethods($uri)
+ {
try {
$node = $this->server->tree->getNodeForPath($uri);
} catch (NotFound $e) {
@@ -154,21 +153,21 @@ class Plugin extends ServerPlugin {
}
return [];
-
}
/**
* This method handles POST request for the outbox.
*
- * @param RequestInterface $request
+ * @param RequestInterface $request
* @param ResponseInterface $response
+ *
* @return bool
*/
- function httpPost(RequestInterface $request, ResponseInterface $response) {
-
+ public function httpPost(RequestInterface $request, ResponseInterface $response)
+ {
// Checking if this is a text/calendar content type
$contentType = $request->getHeader('Content-Type');
- if (strpos($contentType, 'text/calendar') !== 0) {
+ if (!$contentType || 0 !== strpos($contentType, 'text/calendar')) {
return;
}
@@ -180,8 +179,9 @@ class Plugin extends ServerPlugin {
} catch (NotFound $e) {
return;
}
- if (!$node instanceof IOutbox)
+ if (!$node instanceof IOutbox) {
return;
+ }
$this->server->transactionType = 'post-caldav-outbox';
$this->outboxRequest($node, $request, $response);
@@ -189,7 +189,6 @@ class Plugin extends ServerPlugin {
// Returning false breaks the event chain and tells the server we've
// handled the request.
return false;
-
}
/**
@@ -198,43 +197,36 @@ class Plugin extends ServerPlugin {
* We use this event to add calendar-auto-schedule-specific properties.
*
* @param PropFind $propFind
- * @param INode $node
- * @return void
+ * @param INode $node
*/
- function propFind(PropFind $propFind, INode $node) {
-
+ public function propFind(PropFind $propFind, INode $node)
+ {
if ($node instanceof DAVACL\IPrincipal) {
-
$caldavPlugin = $this->server->getPlugin('caldav');
$principalUrl = $node->getPrincipalUrl();
// schedule-outbox-URL property
- $propFind->handle('{' . self::NS_CALDAV . '}schedule-outbox-URL', function() use ($principalUrl, $caldavPlugin) {
-
+ $propFind->handle('{'.self::NS_CALDAV.'}schedule-outbox-URL', function () use ($principalUrl, $caldavPlugin) {
$calendarHomePath = $caldavPlugin->getCalendarHomeForPrincipal($principalUrl);
if (!$calendarHomePath) {
return null;
}
- $outboxPath = $calendarHomePath . '/outbox/';
+ $outboxPath = $calendarHomePath.'/outbox/';
return new LocalHref($outboxPath);
-
});
// schedule-inbox-URL property
- $propFind->handle('{' . self::NS_CALDAV . '}schedule-inbox-URL', function() use ($principalUrl, $caldavPlugin) {
-
+ $propFind->handle('{'.self::NS_CALDAV.'}schedule-inbox-URL', function () use ($principalUrl, $caldavPlugin) {
$calendarHomePath = $caldavPlugin->getCalendarHomeForPrincipal($principalUrl);
if (!$calendarHomePath) {
return null;
}
- $inboxPath = $calendarHomePath . '/inbox/';
+ $inboxPath = $calendarHomePath.'/inbox/';
return new LocalHref($inboxPath);
-
});
- $propFind->handle('{' . self::NS_CALDAV . '}schedule-default-calendar-URL', function() use ($principalUrl, $caldavPlugin) {
-
+ $propFind->handle('{'.self::NS_CALDAV.'}schedule-default-calendar-URL', function () use ($principalUrl, $caldavPlugin) {
// We don't support customizing this property yet, so in the
// meantime we just grab the first calendar in the home-set.
$calendarHomePath = $caldavPlugin->getCalendarHomeForPrincipal($principalUrl);
@@ -243,7 +235,7 @@ class Plugin extends ServerPlugin {
return null;
}
- $sccs = '{' . self::NS_CALDAV . '}supported-calendar-component-set';
+ $sccs = '{'.self::NS_CALDAV.'}supported-calendar-component-set';
$result = $this->server->getPropertiesForPath($calendarHomePath, [
'{DAV:}resourcetype',
@@ -252,18 +244,17 @@ class Plugin extends ServerPlugin {
], 1);
foreach ($result as $child) {
- if (!isset($child[200]['{DAV:}resourcetype']) || !$child[200]['{DAV:}resourcetype']->is('{' . self::NS_CALDAV . '}calendar')) {
+ if (!isset($child[200]['{DAV:}resourcetype']) || !$child[200]['{DAV:}resourcetype']->is('{'.self::NS_CALDAV.'}calendar')) {
// Node is either not a calendar
continue;
}
if (isset($child[200]['{DAV:}share-access'])) {
$shareAccess = $child[200]['{DAV:}share-access']->getValue();
- if ($shareAccess !== Sharing\Plugin::ACCESS_NOTSHARED && $shareAccess !== Sharing\Plugin::ACCESS_SHAREDOWNER) {
+ if (Sharing\Plugin::ACCESS_NOTSHARED !== $shareAccess && Sharing\Plugin::ACCESS_SHAREDOWNER !== $shareAccess) {
// Node is a shared node, not owned by the relevant
// user.
continue;
}
-
}
if (!isset($child[200][$sccs]) || in_array('VEVENT', $child[200][$sccs]->getValue())) {
// Either there is no supported-calendar-component-set
@@ -271,82 +262,70 @@ class Plugin extends ServerPlugin {
return new LocalHref($child['href']);
}
}
-
});
// The server currently reports every principal to be of type
// 'INDIVIDUAL'
- $propFind->handle('{' . self::NS_CALDAV . '}calendar-user-type', function() {
-
+ $propFind->handle('{'.self::NS_CALDAV.'}calendar-user-type', function () {
return 'INDIVIDUAL';
-
});
-
}
// Mapping the old property to the new property.
- $propFind->handle('{http://calendarserver.org/ns/}calendar-availability', function() use ($propFind, $node) {
-
- // In case it wasn't clear, the only difference is that we map the
+ $propFind->handle('{http://calendarserver.org/ns/}calendar-availability', function () use ($propFind, $node) {
+ // In case it wasn't clear, the only difference is that we map the
// old property to a different namespace.
- $availProp = '{' . self::NS_CALDAV . '}calendar-availability';
- $subPropFind = new PropFind(
+ $availProp = '{'.self::NS_CALDAV.'}calendar-availability';
+ $subPropFind = new PropFind(
$propFind->getPath(),
[$availProp]
);
- $this->server->getPropertiesByNode(
+ $this->server->getPropertiesByNode(
$subPropFind,
$node
);
- $propFind->set(
+ $propFind->set(
'{http://calendarserver.org/ns/}calendar-availability',
$subPropFind->get($availProp),
$subPropFind->getStatus($availProp)
);
-
});
-
}
/**
* This method is called during property updates.
*
- * @param string $path
+ * @param string $path
* @param PropPatch $propPatch
- * @return void
*/
- function propPatch($path, PropPatch $propPatch) {
-
+ public function propPatch($path, PropPatch $propPatch)
+ {
// Mapping the old property to the new property.
- $propPatch->handle('{http://calendarserver.org/ns/}calendar-availability', function($value) use ($path) {
-
- $availProp = '{' . self::NS_CALDAV . '}calendar-availability';
+ $propPatch->handle('{http://calendarserver.org/ns/}calendar-availability', function ($value) use ($path) {
+ $availProp = '{'.self::NS_CALDAV.'}calendar-availability';
$subPropPatch = new PropPatch([$availProp => $value]);
$this->server->emit('propPatch', [$path, $subPropPatch]);
$subPropPatch->commit();
return $subPropPatch->getResult()[$availProp];
-
});
-
}
/**
* This method is triggered whenever there was a calendar object gets
* created or updated.
*
- * @param RequestInterface $request HTTP request
- * @param ResponseInterface $response HTTP Response
- * @param VCalendar $vCal Parsed iCalendar object
- * @param mixed $calendarPath Path to calendar collection
- * @param mixed $modified The iCalendar object has been touched.
- * @param mixed $isNew Whether this was a new item or we're updating one
- * @return void
+ * @param RequestInterface $request HTTP request
+ * @param ResponseInterface $response HTTP Response
+ * @param VCalendar $vCal Parsed iCalendar object
+ * @param mixed $calendarPath Path to calendar collection
+ * @param mixed $modified the iCalendar object has been touched
+ * @param mixed $isNew Whether this was a new item or we're updating one
*/
- function calendarObjectChange(RequestInterface $request, ResponseInterface $response, VCalendar $vCal, $calendarPath, &$modified, $isNew) {
-
+ public function calendarObjectChange(RequestInterface $request, ResponseInterface $response, VCalendar $vCal, $calendarPath, &$modified, $isNew)
+ {
if (!$this->scheduleReply($this->server->httpRequest)) {
return;
}
@@ -370,17 +349,15 @@ class Plugin extends ServerPlugin {
// Destroy circular references so PHP will GC the object.
$oldObj->destroy();
}
-
}
/**
* This method is responsible for delivering the ITip message.
*
* @param ITip\Message $iTipMessage
- * @return void
*/
- function deliver(ITip\Message $iTipMessage) {
-
+ public function deliver(ITip\Message $iTipMessage)
+ {
$this->server->emit('schedule', [$iTipMessage]);
if (!$iTipMessage->scheduleStatus) {
$iTipMessage->scheduleStatus = '5.2;There was no system capable of delivering the scheduling message';
@@ -391,7 +368,6 @@ class Plugin extends ServerPlugin {
if (!$iTipMessage->significantChange && in_array($baseCode, ['3', '5'])) {
$iTipMessage->scheduleStatus = null;
}
-
}
/**
@@ -401,13 +377,14 @@ class Plugin extends ServerPlugin {
* cancellations, and organizers get 'DECLINED' statuses.
*
* @param string $path
- * @return void
*/
- function beforeUnbind($path) {
-
+ public function beforeUnbind($path)
+ {
// FIXME: We shouldn't trigger this functionality when we're issuing a
// MOVE. This is a hack.
- if ($this->server->httpRequest->getMethod() === 'MOVE') return;
+ if ('MOVE' === $this->server->httpRequest->getMethod()) {
+ return;
+ }
$node = $this->server->tree->getNodeForPath($path);
@@ -429,7 +406,6 @@ class Plugin extends ServerPlugin {
foreach ($messages as $message) {
$this->deliver($message);
}
-
}
/**
@@ -439,10 +415,9 @@ class Plugin extends ServerPlugin {
* scheduling object.
*
* @param ITip\Message $iTipMessage
- * @return void
*/
- function scheduleLocalDelivery(ITip\Message $iTipMessage) {
-
+ public function scheduleLocalDelivery(ITip\Message $iTipMessage)
+ {
$aclPlugin = $this->server->getPlugin('acl');
// Local delivery is not available if the ACL plugin is not loaded.
@@ -450,11 +425,12 @@ class Plugin extends ServerPlugin {
return;
}
- $caldavNS = '{' . self::NS_CALDAV . '}';
+ $caldavNS = '{'.self::NS_CALDAV.'}';
$principalUri = $aclPlugin->getPrincipalByUri($iTipMessage->recipient);
if (!$principalUri) {
$iTipMessage->scheduleStatus = '3.7;Could not find principal.';
+
return;
}
@@ -470,9 +446,9 @@ class Plugin extends ServerPlugin {
$principalUri,
[
'{DAV:}principal-URL',
- $caldavNS . 'calendar-home-set',
- $caldavNS . 'schedule-inbox-URL',
- $caldavNS . 'schedule-default-calendar-URL',
+ $caldavNS.'calendar-home-set',
+ $caldavNS.'schedule-inbox-URL',
+ $caldavNS.'schedule-default-calendar-URL',
'{http://sabredav.org/ns}email-address',
]
);
@@ -480,31 +456,35 @@ class Plugin extends ServerPlugin {
// Re-registering the ACL event
$this->server->on('propFind', [$aclPlugin, 'propFind'], 20);
- if (!isset($result[$caldavNS . 'schedule-inbox-URL'])) {
+ if (!isset($result[$caldavNS.'schedule-inbox-URL'])) {
$iTipMessage->scheduleStatus = '5.2;Could not find local inbox';
+
return;
}
- if (!isset($result[$caldavNS . 'calendar-home-set'])) {
+ if (!isset($result[$caldavNS.'calendar-home-set'])) {
$iTipMessage->scheduleStatus = '5.2;Could not locate a calendar-home-set';
+
return;
}
- if (!isset($result[$caldavNS . 'schedule-default-calendar-URL'])) {
+ if (!isset($result[$caldavNS.'schedule-default-calendar-URL'])) {
$iTipMessage->scheduleStatus = '5.2;Could not find a schedule-default-calendar-URL property';
+
return;
}
- $calendarPath = $result[$caldavNS . 'schedule-default-calendar-URL']->getHref();
- $homePath = $result[$caldavNS . 'calendar-home-set']->getHref();
- $inboxPath = $result[$caldavNS . 'schedule-inbox-URL']->getHref();
+ $calendarPath = $result[$caldavNS.'schedule-default-calendar-URL']->getHref();
+ $homePath = $result[$caldavNS.'calendar-home-set']->getHref();
+ $inboxPath = $result[$caldavNS.'schedule-inbox-URL']->getHref();
- if ($iTipMessage->method === 'REPLY') {
+ if ('REPLY' === $iTipMessage->method) {
$privilege = 'schedule-deliver-reply';
} else {
$privilege = 'schedule-deliver-invite';
}
- if (!$aclPlugin->checkPrivileges($inboxPath, $caldavNS . $privilege, DAVACL\Plugin::R_PARENT, false)) {
- $iTipMessage->scheduleStatus = '3.8;insufficient privileges: ' . $privilege . ' is required on the recipient schedule inbox.';
+ if (!$aclPlugin->checkPrivileges($inboxPath, $caldavNS.$privilege, DAVACL\Plugin::R_PARENT, false)) {
+ $iTipMessage->scheduleStatus = '3.8;insufficient privileges: '.$privilege.' is required on the recipient schedule inbox.';
+
return;
}
@@ -512,7 +492,7 @@ class Plugin extends ServerPlugin {
// the users' calendars.
$uid = $iTipMessage->uid;
- $newFileName = 'sabredav-' . \Sabre\DAV\UUIDUtil::getUUID() . '.ics';
+ $newFileName = 'sabredav-'.\Sabre\DAV\UUIDUtil::getUUID().'.ics';
$home = $this->server->tree->getNodeForPath($homePath);
$inbox = $this->server->tree->getNodeForPath($inboxPath);
@@ -524,7 +504,7 @@ class Plugin extends ServerPlugin {
$result = $home->getCalendarObjectByUID($uid);
if ($result) {
// There was an existing object, we need to update probably.
- $objectPath = $homePath . '/' . $result;
+ $objectPath = $homePath.'/'.$result;
$objectNode = $this->server->tree->getNodeForPath($objectPath);
$oldICalendarData = $objectNode->get();
$currentObject = Reader::read($oldICalendarData);
@@ -545,6 +525,7 @@ class Plugin extends ServerPlugin {
// The implication is that processMessage did not understand the
// iTip message.
$iTipMessage->scheduleStatus = '5.0;iTip message was not processed by the server, likely because we didn\'t understand it.';
+
return;
}
@@ -558,7 +539,7 @@ class Plugin extends ServerPlugin {
// If the message was a reply, we may have to inform other
// attendees of this attendees status. Therefore we're shooting off
// another itipMessage.
- if ($iTipMessage->method === 'REPLY') {
+ if ('REPLY' === $iTipMessage->method) {
$this->processICalendarChange(
$oldICalendarData,
$newObject,
@@ -569,7 +550,6 @@ class Plugin extends ServerPlugin {
$objectNode->put($newObject->serialize());
}
$iTipMessage->scheduleStatus = '1.2;Message delivered locally';
-
}
/**
@@ -581,54 +561,53 @@ class Plugin extends ServerPlugin {
* @param INode $node
* @param array $supportedPrivilegeSet
*/
- function getSupportedPrivilegeSet(INode $node, array &$supportedPrivilegeSet) {
-
- $ns = '{' . self::NS_CALDAV . '}';
+ public function getSupportedPrivilegeSet(INode $node, array &$supportedPrivilegeSet)
+ {
+ $ns = '{'.self::NS_CALDAV.'}';
if ($node instanceof IOutbox) {
- $supportedPrivilegeSet[$ns . 'schedule-send'] = [
- 'abstract' => false,
+ $supportedPrivilegeSet[$ns.'schedule-send'] = [
+ 'abstract' => false,
'aggregates' => [
- $ns . 'schedule-send-invite' => [
- 'abstract' => false,
+ $ns.'schedule-send-invite' => [
+ 'abstract' => false,
'aggregates' => [],
],
- $ns . 'schedule-send-reply' => [
- 'abstract' => false,
+ $ns.'schedule-send-reply' => [
+ 'abstract' => false,
'aggregates' => [],
],
- $ns . 'schedule-send-freebusy' => [
- 'abstract' => false,
+ $ns.'schedule-send-freebusy' => [
+ 'abstract' => false,
'aggregates' => [],
],
// Privilege from an earlier scheduling draft, but still
// used by some clients.
- $ns . 'schedule-post-vevent' => [
- 'abstract' => false,
+ $ns.'schedule-post-vevent' => [
+ 'abstract' => false,
'aggregates' => [],
],
- ]
+ ],
];
}
if ($node instanceof IInbox) {
- $supportedPrivilegeSet[$ns . 'schedule-deliver'] = [
- 'abstract' => false,
+ $supportedPrivilegeSet[$ns.'schedule-deliver'] = [
+ 'abstract' => false,
'aggregates' => [
- $ns . 'schedule-deliver-invite' => [
- 'abstract' => false,
+ $ns.'schedule-deliver-invite' => [
+ 'abstract' => false,
'aggregates' => [],
],
- $ns . 'schedule-deliver-reply' => [
- 'abstract' => false,
+ $ns.'schedule-deliver-reply' => [
+ 'abstract' => false,
'aggregates' => [],
],
- $ns . 'schedule-query-freebusy' => [
- 'abstract' => false,
+ $ns.'schedule-query-freebusy' => [
+ 'abstract' => false,
'aggregates' => [],
],
- ]
+ ],
];
}
-
}
/**
@@ -642,22 +621,22 @@ class Plugin extends ServerPlugin {
* This method may update $newObject to add any status changes.
*
* @param VCalendar|string $oldObject
- * @param VCalendar $newObject
- * @param array $addresses
- * @param array $ignore Any addresses to not send messages to.
- * @param bool $modified A marker to indicate that the original object
- * modified by this process.
- * @return void
+ * @param VCalendar $newObject
+ * @param array $addresses
+ * @param array $ignore any addresses to not send messages to
+ * @param bool $modified a marker to indicate that the original object
+ * modified by this process
*/
- protected function processICalendarChange($oldObject = null, VCalendar $newObject, array $addresses, array $ignore = [], &$modified = false) {
-
+ protected function processICalendarChange($oldObject = null, VCalendar $newObject, array $addresses, array $ignore = [], &$modified = false)
+ {
$broker = new ITip\Broker();
$messages = $broker->parseEvent($newObject, $addresses, $oldObject);
- if ($messages) $modified = true;
+ if ($messages) {
+ $modified = true;
+ }
foreach ($messages as $message) {
-
if (in_array($message->recipient, $ignore)) {
continue;
}
@@ -669,36 +648,32 @@ class Plugin extends ServerPlugin {
$newObject->VEVENT->ORGANIZER['SCHEDULE-STATUS'] = $message->getScheduleStatus();
}
unset($newObject->VEVENT->ORGANIZER['SCHEDULE-FORCE-SEND']);
-
} else {
-
- if (isset($newObject->VEVENT->ATTENDEE)) foreach ($newObject->VEVENT->ATTENDEE as $attendee) {
-
- if ($attendee->getNormalizedValue() === $message->recipient) {
- if ($message->scheduleStatus) {
- $attendee['SCHEDULE-STATUS'] = $message->getScheduleStatus();
+ if (isset($newObject->VEVENT->ATTENDEE)) {
+ foreach ($newObject->VEVENT->ATTENDEE as $attendee) {
+ if ($attendee->getNormalizedValue() === $message->recipient) {
+ if ($message->scheduleStatus) {
+ $attendee['SCHEDULE-STATUS'] = $message->getScheduleStatus();
+ }
+ unset($attendee['SCHEDULE-FORCE-SEND']);
+ break;
}
- unset($attendee['SCHEDULE-FORCE-SEND']);
- break;
}
-
}
-
}
-
}
-
}
/**
* Returns a list of addresses that are associated with a principal.
*
* @param string $principal
+ *
* @return array
*/
- protected function getAddressesForPrincipal($principal) {
-
- $CUAS = '{' . self::NS_CALDAV . '}calendar-user-address-set';
+ protected function getAddressesForPrincipal($principal)
+ {
+ $CUAS = '{'.self::NS_CALDAV.'}calendar-user-address-set';
$properties = $this->server->getProperties(
$principal,
@@ -707,12 +682,12 @@ class Plugin extends ServerPlugin {
// If we can't find this information, we'll stop processing
if (!isset($properties[$CUAS])) {
- return;
+ return [];
}
$addresses = $properties[$CUAS]->getHrefs();
- return $addresses;
+ return $addresses;
}
/**
@@ -726,20 +701,19 @@ class Plugin extends ServerPlugin {
* extensions, but iCal depends on a feature from that spec, so we
* implement it.
*
- * @param IOutbox $outboxNode
- * @param RequestInterface $request
+ * @param IOutbox $outboxNode
+ * @param RequestInterface $request
* @param ResponseInterface $response
- * @return void
*/
- function outboxRequest(IOutbox $outboxNode, RequestInterface $request, ResponseInterface $response) {
-
+ public function outboxRequest(IOutbox $outboxNode, RequestInterface $request, ResponseInterface $response)
+ {
$outboxPath = $request->getPath();
// Parsing the request body
try {
$vObject = VObject\Reader::read($request->getBody());
} catch (VObject\ParseException $e) {
- throw new BadRequest('The request body must be a valid iCalendar object. Parse error: ' . $e->getMessage());
+ throw new BadRequest('The request body must be a valid iCalendar object. Parse error: '.$e->getMessage());
}
// The incoming iCalendar object must have a METHOD property, and a
@@ -747,7 +721,7 @@ class Plugin extends ServerPlugin {
// this is.
$componentType = null;
foreach ($vObject->getComponents() as $component) {
- if ($component->name !== 'VTIMEZONE') {
+ if ('VTIMEZONE' !== $component->name) {
$componentType = $component->name;
break;
}
@@ -757,7 +731,7 @@ class Plugin extends ServerPlugin {
}
// Validating the METHOD
- $method = strtoupper((string)$vObject->METHOD);
+ $method = strtoupper((string) $vObject->METHOD);
if (!$method) {
throw new BadRequest('A METHOD property must be specified in iTIP messages');
}
@@ -768,46 +742,42 @@ class Plugin extends ServerPlugin {
$acl = $this->server->getPlugin('acl');
- if ($componentType === 'VFREEBUSY' && $method === 'REQUEST') {
-
- $acl && $acl->checkPrivileges($outboxPath, '{' . self::NS_CALDAV . '}schedule-send-freebusy');
+ if ('VFREEBUSY' === $componentType && 'REQUEST' === $method) {
+ $acl && $acl->checkPrivileges($outboxPath, '{'.self::NS_CALDAV.'}schedule-send-freebusy');
$this->handleFreeBusyRequest($outboxNode, $vObject, $request, $response);
// Destroy circular references so PHP can GC the object.
$vObject->destroy();
unset($vObject);
-
} else {
-
throw new NotImplemented('We only support VFREEBUSY (REQUEST) on this endpoint');
-
}
-
}
/**
* This method is responsible for parsing a free-busy query request and
* returning it's result.
*
- * @param IOutbox $outbox
+ * @param IOutbox $outbox
* @param VObject\Component $vObject
- * @param RequestInterface $request
+ * @param RequestInterface $request
* @param ResponseInterface $response
+ *
* @return string
*/
- protected function handleFreeBusyRequest(IOutbox $outbox, VObject\Component $vObject, RequestInterface $request, ResponseInterface $response) {
-
+ protected function handleFreeBusyRequest(IOutbox $outbox, VObject\Component $vObject, RequestInterface $request, ResponseInterface $response)
+ {
$vFreeBusy = $vObject->VFREEBUSY;
$organizer = $vFreeBusy->ORGANIZER;
- $organizer = (string)$organizer;
+ $organizer = (string) $organizer;
// Validating if the organizer matches the owner of the inbox.
$owner = $outbox->getOwner();
- $caldavNS = '{' . self::NS_CALDAV . '}';
+ $caldavNS = '{'.self::NS_CALDAV.'}';
- $uas = $caldavNS . 'calendar-user-address-set';
+ $uas = $caldavNS.'calendar-user-address-set';
$props = $this->server->getProperties($owner, [$uas]);
if (empty($props[$uas]) || !in_array($organizer, $props[$uas]->getHrefs())) {
@@ -820,10 +790,9 @@ class Plugin extends ServerPlugin {
$attendees = [];
foreach ($vFreeBusy->ATTENDEE as $attendee) {
- $attendees[] = (string)$attendee;
+ $attendees[] = (string) $attendee;
}
-
if (!isset($vFreeBusy->DTSTART) || !isset($vFreeBusy->DTEND)) {
throw new BadRequest('DTSTART and DTEND must both be specified');
}
@@ -840,9 +809,7 @@ class Plugin extends ServerPlugin {
$dom->formatOutput = true;
$scheduleResponse = $dom->createElement('cal:schedule-response');
foreach ($this->server->xml->namespaceMap as $namespace => $prefix) {
-
- $scheduleResponse->setAttribute('xmlns:' . $prefix, $namespace);
-
+ $scheduleResponse->setAttribute('xmlns:'.$prefix, $namespace);
}
$dom->appendChild($scheduleResponse);
@@ -861,11 +828,9 @@ class Plugin extends ServerPlugin {
$xresponse->appendChild($reqStatus);
if (isset($result['calendar-data'])) {
-
$calendardata = $dom->createElement('cal:calendar-data');
$calendardata->appendChild($dom->createTextNode(str_replace("\r\n", "\n", $result['calendar-data']->serialize())));
$xresponse->appendChild($calendardata);
-
}
$scheduleResponse->appendChild($xresponse);
}
@@ -873,12 +838,11 @@ class Plugin extends ServerPlugin {
$response->setStatus(200);
$response->setHeader('Content-Type', 'application/xml');
$response->setBody($dom->saveXML());
-
}
/**
* Returns free-busy information for a specific address. The returned
- * data is an array containing the following properties:
+ * data is an array containing the following properties:.
*
* calendar-data : A VFREEBUSY VObject
* request-status : an iTip status code.
@@ -888,54 +852,56 @@ class Plugin extends ServerPlugin {
* * 2.0;description
* * 3.7;description
*
- * @param string $email address
+ * @param string $email address
* @param \DateTimeInterface $start
* @param \DateTimeInterface $end
- * @param VObject\Component $request
+ * @param VObject\Component $request
+ *
* @return array
*/
- protected function getFreeBusyForEmail($email, \DateTimeInterface $start, \DateTimeInterface $end, VObject\Component $request) {
-
- $caldavNS = '{' . self::NS_CALDAV . '}';
+ protected function getFreeBusyForEmail($email, \DateTimeInterface $start, \DateTimeInterface $end, VObject\Component $request)
+ {
+ $caldavNS = '{'.self::NS_CALDAV.'}';
$aclPlugin = $this->server->getPlugin('acl');
- if (substr($email, 0, 7) === 'mailto:') $email = substr($email, 7);
+ if ('mailto:' === substr($email, 0, 7)) {
+ $email = substr($email, 7);
+ }
$result = $aclPlugin->principalSearch(
['{http://sabredav.org/ns}email-address' => $email],
[
'{DAV:}principal-URL',
- $caldavNS . 'calendar-home-set',
- $caldavNS . 'schedule-inbox-URL',
+ $caldavNS.'calendar-home-set',
+ $caldavNS.'schedule-inbox-URL',
'{http://sabredav.org/ns}email-address',
-
]
);
if (!count($result)) {
return [
'request-status' => '3.7;Could not find principal',
- 'href' => 'mailto:' . $email,
+ 'href' => 'mailto:'.$email,
];
}
- if (!isset($result[0][200][$caldavNS . 'calendar-home-set'])) {
+ if (!isset($result[0][200][$caldavNS.'calendar-home-set'])) {
return [
'request-status' => '3.7;No calendar-home-set property found',
- 'href' => 'mailto:' . $email,
+ 'href' => 'mailto:'.$email,
];
}
- if (!isset($result[0][200][$caldavNS . 'schedule-inbox-URL'])) {
+ if (!isset($result[0][200][$caldavNS.'schedule-inbox-URL'])) {
return [
'request-status' => '3.7;No schedule-inbox-URL property found',
- 'href' => 'mailto:' . $email,
+ 'href' => 'mailto:'.$email,
];
}
- $homeSet = $result[0][200][$caldavNS . 'calendar-home-set']->getHref();
- $inboxUrl = $result[0][200][$caldavNS . 'schedule-inbox-URL']->getHref();
+ $homeSet = $result[0][200][$caldavNS.'calendar-home-set']->getHref();
+ $inboxUrl = $result[0][200][$caldavNS.'schedule-inbox-URL']->getHref();
// Do we have permission?
- $aclPlugin->checkPrivileges($inboxUrl, $caldavNS . 'schedule-query-freebusy');
+ $aclPlugin->checkPrivileges($inboxUrl, $caldavNS.'schedule-query-freebusy');
// Grabbing the calendar list
$objects = [];
@@ -946,11 +912,11 @@ class Plugin extends ServerPlugin {
continue;
}
- $sct = $caldavNS . 'schedule-calendar-transp';
- $ctz = $caldavNS . 'calendar-timezone';
+ $sct = $caldavNS.'schedule-calendar-transp';
+ $ctz = $caldavNS.'calendar-timezone';
$props = $node->getProperties([$sct, $ctz]);
- if (isset($props[$sct]) && $props[$sct]->getValue() == ScheduleCalendarTransp::TRANSPARENT) {
+ if (isset($props[$sct]) && ScheduleCalendarTransp::TRANSPARENT == $props[$sct]->getValue()) {
// If a calendar is marked as 'transparent', it means we must
// ignore it for free-busy purposes.
continue;
@@ -962,41 +928,40 @@ class Plugin extends ServerPlugin {
// Destroy circular references so PHP can garbage collect the object.
$vtimezoneObj->destroy();
-
}
// Getting the list of object uris within the time-range
$urls = $node->calendarQuery([
- 'name' => 'VCALENDAR',
+ 'name' => 'VCALENDAR',
'comp-filters' => [
[
- 'name' => 'VEVENT',
- 'comp-filters' => [],
- 'prop-filters' => [],
+ 'name' => 'VEVENT',
+ 'comp-filters' => [],
+ 'prop-filters' => [],
'is-not-defined' => false,
- 'time-range' => [
+ 'time-range' => [
'start' => $start,
- 'end' => $end,
+ 'end' => $end,
],
],
],
- 'prop-filters' => [],
+ 'prop-filters' => [],
'is-not-defined' => false,
- 'time-range' => null,
+ 'time-range' => null,
]);
- $calObjects = array_map(function($url) use ($node) {
+ $calObjects = array_map(function ($url) use ($node) {
$obj = $node->getChild($url)->get();
+
return $obj;
}, $urls);
$objects = array_merge($objects, $calObjects);
-
}
$inboxProps = $this->server->getProperties(
$inboxUrl,
- $caldavNS . 'calendar-availability'
+ $caldavNS.'calendar-availability'
);
$vcalendar = new VObject\Component\VCalendar();
@@ -1011,21 +976,21 @@ class Plugin extends ServerPlugin {
if ($inboxProps) {
$generator->setVAvailability(
VObject\Reader::read(
- $inboxProps[$caldavNS . 'calendar-availability']
+ $inboxProps[$caldavNS.'calendar-availability']
)
);
}
$result = $generator->getResult();
- $vcalendar->VFREEBUSY->ATTENDEE = 'mailto:' . $email;
- $vcalendar->VFREEBUSY->UID = (string)$request->VFREEBUSY->UID;
+ $vcalendar->VFREEBUSY->ATTENDEE = 'mailto:'.$email;
+ $vcalendar->VFREEBUSY->UID = (string) $request->VFREEBUSY->UID;
$vcalendar->VFREEBUSY->ORGANIZER = clone $request->VFREEBUSY->ORGANIZER;
return [
- 'calendar-data' => $result,
+ 'calendar-data' => $result,
'request-status' => '2.0;Success',
- 'href' => 'mailto:' . $email,
+ 'href' => 'mailto:'.$email,
];
}
@@ -1034,13 +999,14 @@ class Plugin extends ServerPlugin {
* and returns false if it's 'F', otherwise true.
*
* @param RequestInterface $request
+ *
* @return bool
*/
- private function scheduleReply(RequestInterface $request) {
-
+ private function scheduleReply(RequestInterface $request)
+ {
$scheduleReply = $request->getHeader('Schedule-Reply');
- return $scheduleReply !== 'F';
+ return 'F' !== $scheduleReply;
}
/**
@@ -1054,13 +1020,12 @@ class Plugin extends ServerPlugin {
*
* @return array
*/
- function getPluginInfo() {
-
+ public function getPluginInfo()
+ {
return [
- 'name' => $this->getPluginName(),
+ 'name' => $this->getPluginName(),
'description' => 'Adds calendar-auto-schedule, as defined in rfc6638',
- 'link' => 'http://sabre.io/dav/scheduling/',
+ 'link' => 'http://sabre.io/dav/scheduling/',
];
-
}
}
diff --git a/vendor/sabre/dav/lib/CalDAV/Schedule/SchedulingObject.php b/vendor/sabre/dav/lib/CalDAV/Schedule/SchedulingObject.php
index 0cd05a965..d34c92327 100644
--- a/vendor/sabre/dav/lib/CalDAV/Schedule/SchedulingObject.php
+++ b/vendor/sabre/dav/lib/CalDAV/Schedule/SchedulingObject.php
@@ -1,35 +1,23 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CalDAV\Schedule;
use Sabre\CalDAV\Backend;
use Sabre\DAV\Exception\MethodNotAllowed;
/**
- * The SchedulingObject represents a scheduling object in the Inbox collection
+ * The SchedulingObject represents a scheduling object in the Inbox collection.
*
* @author Brett (https://github.com/bretten)
* @license http://sabre.io/license/ Modified BSD License
* @copyright Copyright (C) fruux GmbH (https://fruux.com/)
*/
-class SchedulingObject extends \Sabre\CalDAV\CalendarObject implements ISchedulingObject {
-
- /**
- /* The CalDAV backend
- *
- * @var Backend\SchedulingSupport
- */
- protected $caldavBackend;
-
- /**
- * Array with information about this SchedulingObject
- *
- * @var array
- */
- protected $objectData;
-
+class SchedulingObject extends \Sabre\CalDAV\CalendarObject implements ISchedulingObject
+{
/**
- * Constructor
+ * Constructor.
*
* The following properties may be passed within $objectData:
*
@@ -43,73 +31,65 @@ class SchedulingObject extends \Sabre\CalDAV\CalendarObject implements IScheduli
* * acl - (optional) Use this to override the default ACL for the node.
*
* @param Backend\SchedulingSupport $caldavBackend
- * @param array $objectData
+ * @param array $objectData
*/
- function __construct(Backend\SchedulingSupport $caldavBackend, array $objectData) {
-
- $this->caldavBackend = $caldavBackend;
+ public function __construct(Backend\SchedulingSupport $caldavBackend, array $objectData)
+ {
+ parent::__construct($caldavBackend, [], $objectData);
if (!isset($objectData['uri'])) {
throw new \InvalidArgumentException('The objectData argument must contain an \'uri\' property');
}
-
- $this->objectData = $objectData;
-
}
/**
- * Returns the ICalendar-formatted object
+ * Returns the ICalendar-formatted object.
*
* @return string
*/
- function get() {
-
+ public function get()
+ {
// Pre-populating the 'calendardata' is optional, if we don't have it
// already we fetch it from the backend.
if (!isset($this->objectData['calendardata'])) {
$this->objectData = $this->caldavBackend->getSchedulingObject($this->objectData['principaluri'], $this->objectData['uri']);
}
- return $this->objectData['calendardata'];
+ return $this->objectData['calendardata'];
}
/**
- * Updates the ICalendar-formatted object
+ * Updates the ICalendar-formatted object.
*
* @param string|resource $calendarData
+ *
* @return string
*/
- function put($calendarData) {
-
+ public function put($calendarData)
+ {
throw new MethodNotAllowed('Updating scheduling objects is not supported');
-
}
/**
- * Deletes the scheduling message
- *
- * @return void
+ * Deletes the scheduling message.
*/
- function delete() {
-
+ public function delete()
+ {
$this->caldavBackend->deleteSchedulingObject($this->objectData['principaluri'], $this->objectData['uri']);
-
}
/**
- * Returns the owner principal
+ * Returns the owner principal.
*
* This must be a url to a principal, or null if there's no owner
*
* @return string|null
*/
- function getOwner() {
-
+ public function getOwner()
+ {
return $this->objectData['principaluri'];
-
}
-
/**
* Returns a list of ACE's for this node.
*
@@ -122,8 +102,8 @@ class SchedulingObject extends \Sabre\CalDAV\CalendarObject implements IScheduli
*
* @return array
*/
- function getACL() {
-
+ public function getACL()
+ {
// An alternative acl may be specified in the object data.
//
@@ -140,16 +120,14 @@ class SchedulingObject extends \Sabre\CalDAV\CalendarObject implements IScheduli
],
[
'privilege' => '{DAV:}all',
- 'principal' => $this->objectData['principaluri'] . '/calendar-proxy-write',
+ 'principal' => $this->objectData['principaluri'].'/calendar-proxy-write',
'protected' => true,
],
[
'privilege' => '{DAV:}read',
- 'principal' => $this->objectData['principaluri'] . '/calendar-proxy-read',
+ 'principal' => $this->objectData['principaluri'].'/calendar-proxy-read',
'protected' => true,
],
];
-
}
-
}
diff --git a/vendor/sabre/dav/lib/CalDAV/SharedCalendar.php b/vendor/sabre/dav/lib/CalDAV/SharedCalendar.php
index 7a77616e3..818392f57 100644
--- a/vendor/sabre/dav/lib/CalDAV/SharedCalendar.php
+++ b/vendor/sabre/dav/lib/CalDAV/SharedCalendar.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CalDAV;
use Sabre\DAV\Sharing\Plugin as SPlugin;
@@ -11,8 +13,8 @@ use Sabre\DAV\Sharing\Plugin as SPlugin;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-class SharedCalendar extends Calendar implements ISharedCalendar {
-
+class SharedCalendar extends Calendar implements ISharedCalendar
+{
/**
* Returns the 'access level' for the instance of this shared resource.
*
@@ -21,10 +23,9 @@ class SharedCalendar extends Calendar implements ISharedCalendar {
*
* @return int
*/
- function getShareAccess() {
-
+ public function getShareAccess()
+ {
return isset($this->calendarInfo['share-access']) ? $this->calendarInfo['share-access'] : SPlugin::ACCESS_NOTSHARED;
-
}
/**
@@ -38,10 +39,9 @@ class SharedCalendar extends Calendar implements ISharedCalendar {
*
* @return string
*/
- function getShareResourceUri() {
-
+ public function getShareResourceUri()
+ {
return $this->calendarInfo['share-resource-uri'];
-
}
/**
@@ -50,12 +50,10 @@ class SharedCalendar extends Calendar implements ISharedCalendar {
* Every item must be a Sharee object.
*
* @param \Sabre\DAV\Xml\Element\Sharee[] $sharees
- * @return void
*/
- function updateInvites(array $sharees) {
-
+ public function updateInvites(array $sharees)
+ {
$this->caldavBackend->updateInvites($this->calendarInfo['id'], $sharees);
-
}
/**
@@ -74,10 +72,9 @@ class SharedCalendar extends Calendar implements ISharedCalendar {
*
* @return \Sabre\DAV\Xml\Element\Sharee[]
*/
- function getInvites() {
-
+ public function getInvites()
+ {
return $this->caldavBackend->getInvites($this->calendarInfo['id']);
-
}
/**
@@ -87,12 +84,10 @@ class SharedCalendar extends Calendar implements ISharedCalendar {
* subscribable calendar.
*
* @param bool $value
- * @return void
*/
- function setPublishStatus($value) {
-
+ public function setPublishStatus($value)
+ {
$this->caldavBackend->setPublishStatus($this->calendarInfo['id'], $value);
-
}
/**
@@ -107,13 +102,13 @@ class SharedCalendar extends Calendar implements ISharedCalendar {
*
* @return array
*/
- function getACL() {
-
+ public function getACL()
+ {
$acl = [];
switch ($this->getShareAccess()) {
- case SPlugin::ACCESS_NOTSHARED :
- case SPlugin::ACCESS_SHAREDOWNER :
+ case SPlugin::ACCESS_NOTSHARED:
+ case SPlugin::ACCESS_SHAREDOWNER:
$acl[] = [
'privilege' => '{DAV:}share',
'principal' => $this->calendarInfo['principaluri'],
@@ -121,11 +116,11 @@ class SharedCalendar extends Calendar implements ISharedCalendar {
];
$acl[] = [
'privilege' => '{DAV:}share',
- 'principal' => $this->calendarInfo['principaluri'] . '/calendar-proxy-write',
+ 'principal' => $this->calendarInfo['principaluri'].'/calendar-proxy-write',
'protected' => true,
];
- // No break intentional!
- case SPlugin::ACCESS_READWRITE :
+ // no break intentional!
+ case SPlugin::ACCESS_READWRITE:
$acl[] = [
'privilege' => '{DAV:}write',
'principal' => $this->calendarInfo['principaluri'],
@@ -133,11 +128,11 @@ class SharedCalendar extends Calendar implements ISharedCalendar {
];
$acl[] = [
'privilege' => '{DAV:}write',
- 'principal' => $this->calendarInfo['principaluri'] . '/calendar-proxy-write',
+ 'principal' => $this->calendarInfo['principaluri'].'/calendar-proxy-write',
'protected' => true,
];
- // No break intentional!
- case SPlugin::ACCESS_READ :
+ // no break intentional!
+ case SPlugin::ACCESS_READ:
$acl[] = [
'privilege' => '{DAV:}write-properties',
'principal' => $this->calendarInfo['principaluri'],
@@ -145,7 +140,7 @@ class SharedCalendar extends Calendar implements ISharedCalendar {
];
$acl[] = [
'privilege' => '{DAV:}write-properties',
- 'principal' => $this->calendarInfo['principaluri'] . '/calendar-proxy-write',
+ 'principal' => $this->calendarInfo['principaluri'].'/calendar-proxy-write',
'protected' => true,
];
$acl[] = [
@@ -155,26 +150,25 @@ class SharedCalendar extends Calendar implements ISharedCalendar {
];
$acl[] = [
'privilege' => '{DAV:}read',
- 'principal' => $this->calendarInfo['principaluri'] . '/calendar-proxy-read',
+ 'principal' => $this->calendarInfo['principaluri'].'/calendar-proxy-read',
'protected' => true,
];
$acl[] = [
'privilege' => '{DAV:}read',
- 'principal' => $this->calendarInfo['principaluri'] . '/calendar-proxy-write',
+ 'principal' => $this->calendarInfo['principaluri'].'/calendar-proxy-write',
'protected' => true,
];
$acl[] = [
- 'privilege' => '{' . Plugin::NS_CALDAV . '}read-free-busy',
+ 'privilege' => '{'.Plugin::NS_CALDAV.'}read-free-busy',
'principal' => '{DAV:}authenticated',
'protected' => true,
];
break;
}
- return $acl;
+ return $acl;
}
-
/**
* This method returns the ACL's for calendar objects in this calendar.
* The result of this method automatically gets passed to the
@@ -182,15 +176,13 @@ class SharedCalendar extends Calendar implements ISharedCalendar {
*
* @return array
*/
- function getChildACL() {
-
+ public function getChildACL()
+ {
$acl = [];
switch ($this->getShareAccess()) {
- case SPlugin::ACCESS_NOTSHARED :
- // No break intentional
- case SPlugin::ACCESS_SHAREDOWNER :
- // No break intentional
+ case SPlugin::ACCESS_NOTSHARED:
+ case SPlugin::ACCESS_SHAREDOWNER:
case SPlugin::ACCESS_READWRITE:
$acl[] = [
'privilege' => '{DAV:}write',
@@ -199,10 +191,10 @@ class SharedCalendar extends Calendar implements ISharedCalendar {
];
$acl[] = [
'privilege' => '{DAV:}write',
- 'principal' => $this->calendarInfo['principaluri'] . '/calendar-proxy-write',
+ 'principal' => $this->calendarInfo['principaluri'].'/calendar-proxy-write',
'protected' => true,
];
- // No break intentional
+ // no break intentional
case SPlugin::ACCESS_READ:
$acl[] = [
'privilege' => '{DAV:}read',
@@ -211,19 +203,17 @@ class SharedCalendar extends Calendar implements ISharedCalendar {
];
$acl[] = [
'privilege' => '{DAV:}read',
- 'principal' => $this->calendarInfo['principaluri'] . '/calendar-proxy-write',
+ 'principal' => $this->calendarInfo['principaluri'].'/calendar-proxy-write',
'protected' => true,
];
$acl[] = [
'privilege' => '{DAV:}read',
- 'principal' => $this->calendarInfo['principaluri'] . '/calendar-proxy-read',
+ 'principal' => $this->calendarInfo['principaluri'].'/calendar-proxy-read',
'protected' => true,
];
break;
}
return $acl;
-
}
-
}
diff --git a/vendor/sabre/dav/lib/CalDAV/SharingPlugin.php b/vendor/sabre/dav/lib/CalDAV/SharingPlugin.php
index 5cce79678..be8c46a9e 100644
--- a/vendor/sabre/dav/lib/CalDAV/SharingPlugin.php
+++ b/vendor/sabre/dav/lib/CalDAV/SharingPlugin.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CalDAV;
use Sabre\DAV;
@@ -23,8 +25,8 @@ use Sabre\HTTP\ResponseInterface;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-class SharingPlugin extends DAV\ServerPlugin {
-
+class SharingPlugin extends DAV\ServerPlugin
+{
/**
* Reference to SabreDAV server object.
*
@@ -40,10 +42,9 @@ class SharingPlugin extends DAV\ServerPlugin {
*
* @return array
*/
- function getFeatures() {
-
+ public function getFeatures()
+ {
return ['calendarserver-sharing'];
-
}
/**
@@ -54,10 +55,9 @@ class SharingPlugin extends DAV\ServerPlugin {
*
* @return string
*/
- function getPluginName() {
-
+ public function getPluginName()
+ {
return 'caldav-sharing';
-
}
/**
@@ -69,10 +69,9 @@ class SharingPlugin extends DAV\ServerPlugin {
* This method should set up the required event subscriptions.
*
* @param DAV\Server $server
- * @return void
*/
- function initialize(DAV\Server $server) {
-
+ public function initialize(DAV\Server $server)
+ {
$this->server = $server;
if (is_null($this->server->getPlugin('sharing'))) {
@@ -81,19 +80,18 @@ class SharingPlugin extends DAV\ServerPlugin {
array_push(
$this->server->protectedProperties,
- '{' . Plugin::NS_CALENDARSERVER . '}invite',
- '{' . Plugin::NS_CALENDARSERVER . '}allowed-sharing-modes',
- '{' . Plugin::NS_CALENDARSERVER . '}shared-url'
+ '{'.Plugin::NS_CALENDARSERVER.'}invite',
+ '{'.Plugin::NS_CALENDARSERVER.'}allowed-sharing-modes',
+ '{'.Plugin::NS_CALENDARSERVER.'}shared-url'
);
- $this->server->xml->elementMap['{' . Plugin::NS_CALENDARSERVER . '}share'] = 'Sabre\\CalDAV\\Xml\\Request\\Share';
- $this->server->xml->elementMap['{' . Plugin::NS_CALENDARSERVER . '}invite-reply'] = 'Sabre\\CalDAV\\Xml\\Request\\InviteReply';
-
- $this->server->on('propFind', [$this, 'propFindEarly']);
- $this->server->on('propFind', [$this, 'propFindLate'], 150);
- $this->server->on('propPatch', [$this, 'propPatch'], 40);
- $this->server->on('method:POST', [$this, 'httpPost']);
+ $this->server->xml->elementMap['{'.Plugin::NS_CALENDARSERVER.'}share'] = 'Sabre\\CalDAV\\Xml\\Request\\Share';
+ $this->server->xml->elementMap['{'.Plugin::NS_CALENDARSERVER.'}invite-reply'] = 'Sabre\\CalDAV\\Xml\\Request\\InviteReply';
+ $this->server->on('propFind', [$this, 'propFindEarly']);
+ $this->server->on('propFind', [$this, 'propFindLate'], 150);
+ $this->server->on('propPatch', [$this, 'propPatch'], 40);
+ $this->server->on('method:POST', [$this, 'httpPost']);
}
/**
@@ -103,47 +101,17 @@ class SharingPlugin extends DAV\ServerPlugin {
* This allows us to inject any properties early.
*
* @param DAV\PropFind $propFind
- * @param DAV\INode $node
- * @return void
+ * @param DAV\INode $node
*/
- function propFindEarly(DAV\PropFind $propFind, DAV\INode $node) {
-
+ public function propFindEarly(DAV\PropFind $propFind, DAV\INode $node)
+ {
if ($node instanceof ISharedCalendar) {
-
- $propFind->handle('{' . Plugin::NS_CALENDARSERVER . '}invite', function() use ($node) {
-
- // Fetching owner information
- $props = $this->server->getPropertiesForPath($node->getOwner(), [
- '{http://sabredav.org/ns}email-address',
- '{DAV:}displayname',
- ], 0);
-
- $ownerInfo = [
- 'href' => $node->getOwner(),
- ];
-
- if (isset($props[0][200])) {
-
- // We're mapping the internal webdav properties to the
- // elements caldav-sharing expects.
- if (isset($props[0][200]['{http://sabredav.org/ns}email-address'])) {
- $ownerInfo['href'] = 'mailto:' . $props[0][200]['{http://sabredav.org/ns}email-address'];
- }
- if (isset($props[0][200]['{DAV:}displayname'])) {
- $ownerInfo['commonName'] = $props[0][200]['{DAV:}displayname'];
- }
-
- }
-
+ $propFind->handle('{'.Plugin::NS_CALENDARSERVER.'}invite', function () use ($node) {
return new Xml\Property\Invite(
- $node->getInvites(),
- $ownerInfo
+ $node->getInvites()
);
-
});
-
}
-
}
/**
@@ -152,31 +120,27 @@ class SharingPlugin extends DAV\ServerPlugin {
* have been shared.
*
* @param DAV\PropFind $propFind
- * @param DAV\INode $node
- * @return void
+ * @param DAV\INode $node
*/
- function propFindLate(DAV\PropFind $propFind, DAV\INode $node) {
-
+ public function propFindLate(DAV\PropFind $propFind, DAV\INode $node)
+ {
if ($node instanceof ISharedCalendar) {
$shareAccess = $node->getShareAccess();
if ($rt = $propFind->get('{DAV:}resourcetype')) {
switch ($shareAccess) {
- case \Sabre\DAV\Sharing\Plugin::ACCESS_SHAREDOWNER :
- $rt->add('{' . Plugin::NS_CALENDARSERVER . '}shared-owner');
+ case \Sabre\DAV\Sharing\Plugin::ACCESS_SHAREDOWNER:
+ $rt->add('{'.Plugin::NS_CALENDARSERVER.'}shared-owner');
break;
- case \Sabre\DAV\Sharing\Plugin::ACCESS_READ :
- case \Sabre\DAV\Sharing\Plugin::ACCESS_READWRITE :
- $rt->add('{' . Plugin::NS_CALENDARSERVER . '}shared');
+ case \Sabre\DAV\Sharing\Plugin::ACCESS_READ:
+ case \Sabre\DAV\Sharing\Plugin::ACCESS_READWRITE:
+ $rt->add('{'.Plugin::NS_CALENDARSERVER.'}shared');
break;
-
}
}
- $propFind->handle('{' . Plugin::NS_CALENDARSERVER . '}allowed-sharing-modes', function() {
+ $propFind->handle('{'.Plugin::NS_CALENDARSERVER.'}allowed-sharing-modes', function () {
return new Xml\Property\AllowedSharingModes(true, false);
});
-
}
-
}
/**
@@ -190,20 +154,21 @@ class SharingPlugin extends DAV\ServerPlugin {
* Even though this is no longer in the current spec, we keep this around
* because OS X 10.7 may still make use of this feature.
*
- * @param string $path
+ * @param string $path
* @param DAV\PropPatch $propPatch
- * @return void
*/
- function propPatch($path, DAV\PropPatch $propPatch) {
-
+ public function propPatch($path, DAV\PropPatch $propPatch)
+ {
$node = $this->server->tree->getNodeForPath($path);
- if (!$node instanceof ISharedCalendar)
+ if (!$node instanceof ISharedCalendar) {
return;
+ }
- if ($node->getShareAccess() === \Sabre\DAV\Sharing\Plugin::ACCESS_SHAREDOWNER || $node->getShareAccess() === \Sabre\DAV\Sharing\Plugin::ACCESS_NOTSHARED) {
-
- $propPatch->handle('{DAV:}resourcetype', function($value) use ($node) {
- if ($value->is('{' . Plugin::NS_CALENDARSERVER . '}shared-owner')) return false;
+ if (\Sabre\DAV\Sharing\Plugin::ACCESS_SHAREDOWNER === $node->getShareAccess() || \Sabre\DAV\Sharing\Plugin::ACCESS_NOTSHARED === $node->getShareAccess()) {
+ $propPatch->handle('{DAV:}resourcetype', function ($value) use ($node) {
+ if ($value->is('{'.Plugin::NS_CALENDARSERVER.'}shared-owner')) {
+ return false;
+ }
$shares = $node->getInvites();
foreach ($shares as $share) {
$share->access = DAV\Sharing\Plugin::ACCESS_NOACCESS;
@@ -211,28 +176,30 @@ class SharingPlugin extends DAV\ServerPlugin {
$node->updateInvites($shares);
return true;
-
});
-
}
-
}
/**
* We intercept this to handle POST requests on calendars.
*
- * @param RequestInterface $request
+ * @param RequestInterface $request
* @param ResponseInterface $response
- * @return null|bool
+ *
+ * @return bool|null
*/
- function httpPost(RequestInterface $request, ResponseInterface $response) {
-
+ public function httpPost(RequestInterface $request, ResponseInterface $response)
+ {
$path = $request->getPath();
// Only handling xml
$contentType = $request->getHeader('Content-Type');
- if (strpos($contentType, 'application/xml') === false && strpos($contentType, 'text/xml') === false)
+ if (null === $contentType) {
return;
+ }
+ if (false === strpos($contentType, 'application/xml') && false === strpos($contentType, 'text/xml')) {
+ return;
+ }
// Making sure the node exists
try {
@@ -255,10 +222,9 @@ class SharingPlugin extends DAV\ServerPlugin {
$message = $this->server->xml->parse($requestBody, $request->getUrl(), $documentType);
switch ($documentType) {
-
// Both the DAV:share-resource and CALENDARSERVER:share requests
// behave identically.
- case '{' . Plugin::NS_CALENDARSERVER . '}share' :
+ case '{'.Plugin::NS_CALENDARSERVER.'}share':
$sharingPlugin = $this->server->getPlugin('sharing');
$sharingPlugin->shareResource($path, $message->sharees);
@@ -273,7 +239,7 @@ class SharingPlugin extends DAV\ServerPlugin {
// The invite-reply document is sent when the user replies to an
// invitation of a calendar share.
- case '{' . Plugin::NS_CALENDARSERVER . '}invite-reply' :
+ case '{'.Plugin::NS_CALENDARSERVER.'}invite-reply':
// This only works on the calendar-home-root node.
if (!$node instanceof CalendarHome) {
@@ -304,20 +270,20 @@ class SharingPlugin extends DAV\ServerPlugin {
if ($url) {
$writer = $this->server->xml->getWriter();
+ $writer->contextUri = $request->getUrl();
$writer->openMemory();
$writer->startDocument();
- $writer->startElement('{' . Plugin::NS_CALENDARSERVER . '}shared-as');
+ $writer->startElement('{'.Plugin::NS_CALENDARSERVER.'}shared-as');
$writer->write(new LocalHref($url));
$writer->endElement();
$response->setHeader('Content-Type', 'application/xml');
$response->setBody($writer->outputMemory());
-
}
// Breaking the event chain
return false;
- case '{' . Plugin::NS_CALENDARSERVER . '}publish-calendar' :
+ case '{'.Plugin::NS_CALENDARSERVER.'}publish-calendar':
// We can only deal with IShareableCalendar objects
if (!$node instanceof ISharedCalendar) {
@@ -345,7 +311,7 @@ class SharingPlugin extends DAV\ServerPlugin {
// Breaking the event chain
return false;
- case '{' . Plugin::NS_CALENDARSERVER . '}unpublish-calendar' :
+ case '{'.Plugin::NS_CALENDARSERVER.'}unpublish-calendar':
// We can only deal with IShareableCalendar objects
if (!$node instanceof ISharedCalendar) {
@@ -371,11 +337,7 @@ class SharingPlugin extends DAV\ServerPlugin {
// Breaking the event chain
return false;
-
}
-
-
-
}
/**
@@ -389,13 +351,12 @@ class SharingPlugin extends DAV\ServerPlugin {
*
* @return array
*/
- function getPluginInfo() {
-
+ public function getPluginInfo()
+ {
return [
- 'name' => $this->getPluginName(),
+ 'name' => $this->getPluginName(),
'description' => 'Adds support for caldav-sharing.',
- 'link' => 'http://sabre.io/dav/caldav-sharing/',
+ 'link' => 'http://sabre.io/dav/caldav-sharing/',
];
-
}
}
diff --git a/vendor/sabre/dav/lib/CalDAV/Subscriptions/ISubscription.php b/vendor/sabre/dav/lib/CalDAV/Subscriptions/ISubscription.php
index 7ba259c7b..e83082c52 100644
--- a/vendor/sabre/dav/lib/CalDAV/Subscriptions/ISubscription.php
+++ b/vendor/sabre/dav/lib/CalDAV/Subscriptions/ISubscription.php
@@ -1,12 +1,14 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CalDAV\Subscriptions;
use Sabre\DAV\ICollection;
use Sabre\DAV\IProperties;
/**
- * ISubscription
+ * ISubscription.
*
* Nodes implementing this interface represent calendar subscriptions.
*
@@ -34,7 +36,6 @@ use Sabre\DAV\IProperties;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-interface ISubscription extends ICollection, IProperties {
-
-
+interface ISubscription extends ICollection, IProperties
+{
}
diff --git a/vendor/sabre/dav/lib/CalDAV/Subscriptions/Plugin.php b/vendor/sabre/dav/lib/CalDAV/Subscriptions/Plugin.php
index 877d96c6c..238866894 100644
--- a/vendor/sabre/dav/lib/CalDAV/Subscriptions/Plugin.php
+++ b/vendor/sabre/dav/lib/CalDAV/Subscriptions/Plugin.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CalDAV\Subscriptions;
use Sabre\DAV\INode;
@@ -17,8 +19,8 @@ use Sabre\DAV\ServerPlugin;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-class Plugin extends ServerPlugin {
-
+class Plugin extends ServerPlugin
+{
/**
* This initializes the plugin.
*
@@ -28,10 +30,9 @@ class Plugin extends ServerPlugin {
* This method should set up the required event subscriptions.
*
* @param Server $server
- * @return void
*/
- function initialize(Server $server) {
-
+ public function initialize(Server $server)
+ {
$server->resourceTypeMapping['Sabre\\CalDAV\\Subscriptions\\ISubscription'] =
'{http://calendarserver.org/ns/}subscribed';
@@ -39,7 +40,6 @@ class Plugin extends ServerPlugin {
'Sabre\\DAV\\Xml\\Property\\Href';
$server->on('propFind', [$this, 'propFind'], 150);
-
}
/**
@@ -50,21 +50,19 @@ class Plugin extends ServerPlugin {
*
* @return array
*/
- function getFeatures() {
-
+ public function getFeatures()
+ {
return ['calendarserver-subscribed'];
-
}
/**
* Triggered after properties have been fetched.
*
* @param PropFind $propFind
- * @param INode $node
- * @return void
+ * @param INode $node
*/
- function propFind(PropFind $propFind, INode $node) {
-
+ public function propFind(PropFind $propFind, INode $node)
+ {
// There's a bunch of properties that must appear as a self-closing
// xml-element. This event handler ensures that this will be the case.
$props = [
@@ -74,13 +72,10 @@ class Plugin extends ServerPlugin {
];
foreach ($props as $prop) {
-
- if ($propFind->getStatus($prop) === 200) {
+ if (200 === $propFind->getStatus($prop)) {
$propFind->set($prop, '', 200);
}
-
}
-
}
/**
@@ -91,10 +86,9 @@ class Plugin extends ServerPlugin {
*
* @return string
*/
- function getPluginName() {
-
+ public function getPluginName()
+ {
return 'subscriptions';
-
}
/**
@@ -108,13 +102,12 @@ class Plugin extends ServerPlugin {
*
* @return array
*/
- function getPluginInfo() {
-
+ public function getPluginInfo()
+ {
return [
- 'name' => $this->getPluginName(),
+ 'name' => $this->getPluginName(),
'description' => 'This plugin allows users to store iCalendar subscriptions in their calendar-home.',
- 'link' => null,
+ 'link' => null,
];
-
}
}
diff --git a/vendor/sabre/dav/lib/CalDAV/Subscriptions/Subscription.php b/vendor/sabre/dav/lib/CalDAV/Subscriptions/Subscription.php
index 6a1851ed8..0b0282abe 100644
--- a/vendor/sabre/dav/lib/CalDAV/Subscriptions/Subscription.php
+++ b/vendor/sabre/dav/lib/CalDAV/Subscriptions/Subscription.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CalDAV\Subscriptions;
use Sabre\CalDAV\Backend\SubscriptionSupport;
@@ -10,7 +12,7 @@ use Sabre\DAVACL\ACLTrait;
use Sabre\DAVACL\IACL;
/**
- * Subscription Node
+ * Subscription Node.
*
* This node represents a subscription.
*
@@ -18,32 +20,32 @@ use Sabre\DAVACL\IACL;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-class Subscription extends Collection implements ISubscription, IACL {
-
+class Subscription extends Collection implements ISubscription, IACL
+{
use ACLTrait;
/**
- * caldavBackend
+ * caldavBackend.
*
* @var SubscriptionSupport
*/
protected $caldavBackend;
/**
- * subscriptionInfo
+ * subscriptionInfo.
*
* @var array
*/
protected $subscriptionInfo;
/**
- * Constructor
+ * Constructor.
*
* @param SubscriptionSupport $caldavBackend
- * @param array $subscriptionInfo
+ * @param array $subscriptionInfo
*/
- function __construct(SubscriptionSupport $caldavBackend, array $subscriptionInfo) {
-
+ public function __construct(SubscriptionSupport $caldavBackend, array $subscriptionInfo)
+ {
$this->caldavBackend = $caldavBackend;
$this->subscriptionInfo = $subscriptionInfo;
@@ -56,10 +58,9 @@ class Subscription extends Collection implements ISubscription, IACL {
foreach ($required as $r) {
if (!isset($subscriptionInfo[$r])) {
- throw new \InvalidArgumentException('The ' . $r . ' field is required when creating a subscription node');
+ throw new \InvalidArgumentException('The '.$r.' field is required when creating a subscription node');
}
}
-
}
/**
@@ -69,47 +70,41 @@ class Subscription extends Collection implements ISubscription, IACL {
*
* @return string
*/
- function getName() {
-
+ public function getName()
+ {
return $this->subscriptionInfo['uri'];
-
}
/**
- * Returns the last modification time
+ * Returns the last modification time.
*
* @return int
*/
- function getLastModified() {
-
+ public function getLastModified()
+ {
if (isset($this->subscriptionInfo['lastmodified'])) {
return $this->subscriptionInfo['lastmodified'];
}
-
}
/**
- * Deletes the current node
- *
- * @return void
+ * Deletes the current node.
*/
- function delete() {
-
+ public function delete()
+ {
$this->caldavBackend->deleteSubscription(
$this->subscriptionInfo['id']
);
-
}
/**
- * Returns an array with all the child nodes
+ * Returns an array with all the child nodes.
*
* @return \Sabre\DAV\INode[]
*/
- function getChildren() {
-
+ public function getChildren()
+ {
return [];
-
}
/**
@@ -122,15 +117,13 @@ class Subscription extends Collection implements ISubscription, IACL {
* Read the PropPatch documentation for more information.
*
* @param PropPatch $propPatch
- * @return void
*/
- function propPatch(PropPatch $propPatch) {
-
+ public function propPatch(PropPatch $propPatch)
+ {
return $this->caldavBackend->updateSubscription(
$this->subscriptionInfo['id'],
$propPatch
);
-
}
/**
@@ -146,29 +139,27 @@ class Subscription extends Collection implements ISubscription, IACL {
* The Server class will filter out the extra.
*
* @param array $properties
+ *
* @return array
*/
- function getProperties($properties) {
-
+ public function getProperties($properties)
+ {
$r = [];
foreach ($properties as $prop) {
-
switch ($prop) {
- case '{http://calendarserver.org/ns/}source' :
+ case '{http://calendarserver.org/ns/}source':
$r[$prop] = new Href($this->subscriptionInfo['source']);
break;
- default :
+ default:
if (array_key_exists($prop, $this->subscriptionInfo)) {
$r[$prop] = $this->subscriptionInfo[$prop];
}
break;
}
-
}
return $r;
-
}
/**
@@ -178,10 +169,9 @@ class Subscription extends Collection implements ISubscription, IACL {
*
* @return string|null
*/
- function getOwner() {
-
+ public function getOwner()
+ {
return $this->subscriptionInfo['principaluri'];
-
}
/**
@@ -196,8 +186,8 @@ class Subscription extends Collection implements ISubscription, IACL {
*
* @return array
*/
- function getACL() {
-
+ public function getACL()
+ {
return [
[
'privilege' => '{DAV:}all',
@@ -206,16 +196,14 @@ class Subscription extends Collection implements ISubscription, IACL {
],
[
'privilege' => '{DAV:}all',
- 'principal' => $this->getOwner() . '/calendar-proxy-write',
+ 'principal' => $this->getOwner().'/calendar-proxy-write',
'protected' => true,
],
[
'privilege' => '{DAV:}read',
- 'principal' => $this->getOwner() . '/calendar-proxy-read',
+ 'principal' => $this->getOwner().'/calendar-proxy-read',
'protected' => true,
- ]
+ ],
];
-
}
-
}
diff --git a/vendor/sabre/dav/lib/CalDAV/Xml/Filter/CalendarData.php b/vendor/sabre/dav/lib/CalDAV/Xml/Filter/CalendarData.php
index 9669be304..0d53aeda3 100644
--- a/vendor/sabre/dav/lib/CalDAV/Xml/Filter/CalendarData.php
+++ b/vendor/sabre/dav/lib/CalDAV/Xml/Filter/CalendarData.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CalDAV\Xml\Filter;
use Sabre\CalDAV\Plugin;
@@ -25,8 +27,8 @@ use Sabre\Xml\XmlDeserializable;
* @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://sabre.io/license/ Modified BSD License
*/
-class CalendarData implements XmlDeserializable {
-
+class CalendarData implements XmlDeserializable
+{
/**
* The deserialize method is called during xml parsing.
*
@@ -46,24 +48,24 @@ class CalendarData implements XmlDeserializable {
* the next element.
*
* @param Reader $reader
+ *
* @return mixed
*/
- static function xmlDeserialize(Reader $reader) {
-
+ public static function xmlDeserialize(Reader $reader)
+ {
$result = [
'contentType' => $reader->getAttribute('content-type') ?: 'text/calendar',
- 'version' => $reader->getAttribute('version') ?: '2.0',
+ 'version' => $reader->getAttribute('version') ?: '2.0',
];
- $elems = (array)$reader->parseInnerTree();
+ $elems = (array) $reader->parseInnerTree();
foreach ($elems as $elem) {
-
switch ($elem['name']) {
- case '{' . Plugin::NS_CALDAV . '}expand' :
+ case '{'.Plugin::NS_CALDAV.'}expand':
$result['expand'] = [
'start' => isset($elem['attributes']['start']) ? DateTimeParser::parseDateTime($elem['attributes']['start']) : null,
- 'end' => isset($elem['attributes']['end']) ? DateTimeParser::parseDateTime($elem['attributes']['end']) : null,
+ 'end' => isset($elem['attributes']['end']) ? DateTimeParser::parseDateTime($elem['attributes']['end']) : null,
];
if (!$result['expand']['start'] || !$result['expand']['end']) {
@@ -74,11 +76,8 @@ class CalendarData implements XmlDeserializable {
}
break;
}
-
}
return $result;
-
}
-
}
diff --git a/vendor/sabre/dav/lib/CalDAV/Xml/Filter/CompFilter.php b/vendor/sabre/dav/lib/CalDAV/Xml/Filter/CompFilter.php
index c21ede66b..832346eea 100644
--- a/vendor/sabre/dav/lib/CalDAV/Xml/Filter/CompFilter.php
+++ b/vendor/sabre/dav/lib/CalDAV/Xml/Filter/CompFilter.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CalDAV\Xml\Filter;
use Sabre\CalDAV\Plugin;
@@ -22,8 +24,8 @@ use Sabre\Xml\XmlDeserializable;
* @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://sabre.io/license/ Modified BSD License
*/
-class CompFilter implements XmlDeserializable {
-
+class CompFilter implements XmlDeserializable
+{
/**
* The deserialize method is called during xml parsing.
*
@@ -43,16 +45,17 @@ class CompFilter implements XmlDeserializable {
* the next element.
*
* @param Reader $reader
+ *
* @return mixed
*/
- static function xmlDeserialize(Reader $reader) {
-
+ public static function xmlDeserialize(Reader $reader)
+ {
$result = [
- 'name' => null,
+ 'name' => null,
'is-not-defined' => false,
- 'comp-filters' => [],
- 'prop-filters' => [],
- 'time-range' => false,
+ 'comp-filters' => [],
+ 'prop-filters' => [],
+ 'time-range' => false,
];
$att = $reader->parseAttributes();
@@ -60,38 +63,34 @@ class CompFilter implements XmlDeserializable {
$elems = $reader->parseInnerTree();
- if (is_array($elems)) foreach ($elems as $elem) {
-
- switch ($elem['name']) {
-
- case '{' . Plugin::NS_CALDAV . '}comp-filter' :
+ if (is_array($elems)) {
+ foreach ($elems as $elem) {
+ switch ($elem['name']) {
+ case '{'.Plugin::NS_CALDAV.'}comp-filter':
$result['comp-filters'][] = $elem['value'];
break;
- case '{' . Plugin::NS_CALDAV . '}prop-filter' :
+ case '{'.Plugin::NS_CALDAV.'}prop-filter':
$result['prop-filters'][] = $elem['value'];
break;
- case '{' . Plugin::NS_CALDAV . '}is-not-defined' :
+ case '{'.Plugin::NS_CALDAV.'}is-not-defined':
$result['is-not-defined'] = true;
break;
- case '{' . Plugin::NS_CALDAV . '}time-range' :
- if ($result['name'] === 'VCALENDAR') {
+ case '{'.Plugin::NS_CALDAV.'}time-range':
+ if ('VCALENDAR' === $result['name']) {
throw new BadRequest('You cannot add time-range filters on the VCALENDAR component');
}
$result['time-range'] = [
'start' => isset($elem['attributes']['start']) ? DateTimeParser::parseDateTime($elem['attributes']['start']) : null,
- 'end' => isset($elem['attributes']['end']) ? DateTimeParser::parseDateTime($elem['attributes']['end']) : null,
+ 'end' => isset($elem['attributes']['end']) ? DateTimeParser::parseDateTime($elem['attributes']['end']) : null,
];
if ($result['time-range']['start'] && $result['time-range']['end'] && $result['time-range']['end'] <= $result['time-range']['start']) {
throw new BadRequest('The end-date must be larger than the start-date');
}
break;
-
}
-
+ }
}
return $result;
-
}
-
}
diff --git a/vendor/sabre/dav/lib/CalDAV/Xml/Filter/ParamFilter.php b/vendor/sabre/dav/lib/CalDAV/Xml/Filter/ParamFilter.php
index bf422cf05..ec9ff753c 100644
--- a/vendor/sabre/dav/lib/CalDAV/Xml/Filter/ParamFilter.php
+++ b/vendor/sabre/dav/lib/CalDAV/Xml/Filter/ParamFilter.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CalDAV\Xml\Filter;
use Sabre\CalDAV\Plugin;
@@ -20,8 +22,8 @@ use Sabre\Xml\XmlDeserializable;
* @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://sabre.io/license/ Modified BSD License
*/
-class ParamFilter implements XmlDeserializable {
-
+class ParamFilter implements XmlDeserializable
+{
/**
* The deserialize method is called during xml parsing.
*
@@ -41,14 +43,15 @@ class ParamFilter implements XmlDeserializable {
* the next element.
*
* @param Reader $reader
+ *
* @return mixed
*/
- static function xmlDeserialize(Reader $reader) {
-
+ public static function xmlDeserialize(Reader $reader)
+ {
$result = [
- 'name' => null,
+ 'name' => null,
'is-not-defined' => false,
- 'text-match' => null,
+ 'text-match' => null,
];
$att = $reader->parseAttributes();
@@ -56,27 +59,23 @@ class ParamFilter implements XmlDeserializable {
$elems = $reader->parseInnerTree();
- if (is_array($elems)) foreach ($elems as $elem) {
-
- switch ($elem['name']) {
-
- case '{' . Plugin::NS_CALDAV . '}is-not-defined' :
+ if (is_array($elems)) {
+ foreach ($elems as $elem) {
+ switch ($elem['name']) {
+ case '{'.Plugin::NS_CALDAV.'}is-not-defined':
$result['is-not-defined'] = true;
break;
- case '{' . Plugin::NS_CALDAV . '}text-match' :
+ case '{'.Plugin::NS_CALDAV.'}text-match':
$result['text-match'] = [
- 'negate-condition' => isset($elem['attributes']['negate-condition']) && $elem['attributes']['negate-condition'] === 'yes',
- 'collation' => isset($elem['attributes']['collation']) ? $elem['attributes']['collation'] : 'i;ascii-casemap',
- 'value' => $elem['value'],
+ 'negate-condition' => isset($elem['attributes']['negate-condition']) && 'yes' === $elem['attributes']['negate-condition'],
+ 'collation' => isset($elem['attributes']['collation']) ? $elem['attributes']['collation'] : 'i;ascii-casemap',
+ 'value' => $elem['value'],
];
break;
-
}
-
+ }
}
return $result;
-
}
-
}
diff --git a/vendor/sabre/dav/lib/CalDAV/Xml/Filter/PropFilter.php b/vendor/sabre/dav/lib/CalDAV/Xml/Filter/PropFilter.php
index db9207295..f4600574e 100644
--- a/vendor/sabre/dav/lib/CalDAV/Xml/Filter/PropFilter.php
+++ b/vendor/sabre/dav/lib/CalDAV/Xml/Filter/PropFilter.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CalDAV\Xml\Filter;
use Sabre\CalDAV\Plugin;
@@ -22,8 +24,8 @@ use Sabre\Xml\XmlDeserializable;
* @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://sabre.io/license/ Modified BSD License
*/
-class PropFilter implements XmlDeserializable {
-
+class PropFilter implements XmlDeserializable
+{
/**
* The deserialize method is called during xml parsing.
*
@@ -43,16 +45,17 @@ class PropFilter implements XmlDeserializable {
* the next element.
*
* @param Reader $reader
+ *
* @return mixed
*/
- static function xmlDeserialize(Reader $reader) {
-
+ public static function xmlDeserialize(Reader $reader)
+ {
$result = [
- 'name' => null,
+ 'name' => null,
'is-not-defined' => false,
- 'param-filters' => [],
- 'text-match' => null,
- 'time-range' => false,
+ 'param-filters' => [],
+ 'text-match' => null,
+ 'time-range' => false,
];
$att = $reader->parseAttributes();
@@ -60,39 +63,35 @@ class PropFilter implements XmlDeserializable {
$elems = $reader->parseInnerTree();
- if (is_array($elems)) foreach ($elems as $elem) {
-
- switch ($elem['name']) {
-
- case '{' . Plugin::NS_CALDAV . '}param-filter' :
+ if (is_array($elems)) {
+ foreach ($elems as $elem) {
+ switch ($elem['name']) {
+ case '{'.Plugin::NS_CALDAV.'}param-filter':
$result['param-filters'][] = $elem['value'];
break;
- case '{' . Plugin::NS_CALDAV . '}is-not-defined' :
+ case '{'.Plugin::NS_CALDAV.'}is-not-defined':
$result['is-not-defined'] = true;
break;
- case '{' . Plugin::NS_CALDAV . '}time-range' :
+ case '{'.Plugin::NS_CALDAV.'}time-range':
$result['time-range'] = [
'start' => isset($elem['attributes']['start']) ? DateTimeParser::parseDateTime($elem['attributes']['start']) : null,
- 'end' => isset($elem['attributes']['end']) ? DateTimeParser::parseDateTime($elem['attributes']['end']) : null,
+ 'end' => isset($elem['attributes']['end']) ? DateTimeParser::parseDateTime($elem['attributes']['end']) : null,
];
if ($result['time-range']['start'] && $result['time-range']['end'] && $result['time-range']['end'] <= $result['time-range']['start']) {
throw new BadRequest('The end-date must be larger than the start-date');
}
break;
- case '{' . Plugin::NS_CALDAV . '}text-match' :
+ case '{'.Plugin::NS_CALDAV.'}text-match':
$result['text-match'] = [
- 'negate-condition' => isset($elem['attributes']['negate-condition']) && $elem['attributes']['negate-condition'] === 'yes',
- 'collation' => isset($elem['attributes']['collation']) ? $elem['attributes']['collation'] : 'i;ascii-casemap',
- 'value' => $elem['value'],
+ 'negate-condition' => isset($elem['attributes']['negate-condition']) && 'yes' === $elem['attributes']['negate-condition'],
+ 'collation' => isset($elem['attributes']['collation']) ? $elem['attributes']['collation'] : 'i;ascii-casemap',
+ 'value' => $elem['value'],
];
break;
-
}
-
+ }
}
return $result;
-
}
-
}
diff --git a/vendor/sabre/dav/lib/CalDAV/Xml/Notification/Invite.php b/vendor/sabre/dav/lib/CalDAV/Xml/Notification/Invite.php
index 92a9ac7b7..926656674 100644
--- a/vendor/sabre/dav/lib/CalDAV/Xml/Notification/Invite.php
+++ b/vendor/sabre/dav/lib/CalDAV/Xml/Notification/Invite.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CalDAV\Xml\Notification;
use Sabre\CalDAV;
@@ -17,19 +19,19 @@ use Sabre\Xml\Writer;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-class Invite implements NotificationInterface {
-
+class Invite implements NotificationInterface
+{
/**
- * A unique id for the message
+ * A unique id for the message.
*
* @var string
*/
protected $id;
/**
- * Timestamp of the notification
+ * Timestamp of the notification.
*
- * @var DateTime
+ * @var \DateTime
*/
protected $dtStamp;
@@ -63,7 +65,7 @@ class Invite implements NotificationInterface {
protected $hostUrl;
/**
- * Url to the sharer of the calendar
+ * Url to the sharer of the calendar.
*
* @var string
*/
@@ -91,21 +93,21 @@ class Invite implements NotificationInterface {
protected $lastName;
/**
- * A description of the share request
+ * A description of the share request.
*
* @var string
*/
protected $summary;
/**
- * The Etag for the notification
+ * The Etag for the notification.
*
* @var string
*/
protected $etag;
/**
- * The list of supported components
+ * The list of supported components.
*
* @var CalDAV\Xml\Property\SupportedCalendarComponentSet
*/
@@ -138,8 +140,8 @@ class Invite implements NotificationInterface {
*
* @param array $values All the options
*/
- function __construct(array $values) {
-
+ public function __construct(array $values)
+ {
$required = [
'id',
'etag',
@@ -152,17 +154,16 @@ class Invite implements NotificationInterface {
];
foreach ($required as $item) {
if (!isset($values[$item])) {
- throw new \InvalidArgumentException($item . ' is a required constructor option');
+ throw new \InvalidArgumentException($item.' is a required constructor option');
}
}
foreach ($values as $key => $value) {
if (!property_exists($this, $key)) {
- throw new \InvalidArgumentException('Unknown option: ' . $key);
+ throw new \InvalidArgumentException('Unknown option: '.$key);
}
$this->$key = $value;
}
-
}
/**
@@ -182,12 +183,10 @@ class Invite implements NotificationInterface {
* If you are opening new elements, you must also close them again.
*
* @param Writer $writer
- * @return void
*/
- function xmlSerialize(Writer $writer) {
-
- $writer->writeElement('{' . CalDAV\Plugin::NS_CALENDARSERVER . '}invite-notification');
-
+ public function xmlSerialize(Writer $writer)
+ {
+ $writer->writeElement('{'.CalDAV\Plugin::NS_CALENDARSERVER.'}invite-notification');
}
/**
@@ -195,95 +194,90 @@ class Invite implements NotificationInterface {
* response body.
*
* @param Writer $writer
- * @return void
*/
- function xmlSerializeFull(Writer $writer) {
+ public function xmlSerializeFull(Writer $writer)
+ {
+ $cs = '{'.CalDAV\Plugin::NS_CALENDARSERVER.'}';
- $cs = '{' . CalDAV\Plugin::NS_CALENDARSERVER . '}';
+ $this->dtStamp->setTimezone(new \DateTimeZone('GMT'));
+ $writer->writeElement($cs.'dtstamp', $this->dtStamp->format('Ymd\\THis\\Z'));
- $this->dtStamp->setTimezone(new \DateTimezone('GMT'));
- $writer->writeElement($cs . 'dtstamp', $this->dtStamp->format('Ymd\\THis\\Z'));
+ $writer->startElement($cs.'invite-notification');
- $writer->startElement($cs . 'invite-notification');
-
- $writer->writeElement($cs . 'uid', $this->id);
+ $writer->writeElement($cs.'uid', $this->id);
$writer->writeElement('{DAV:}href', $this->href);
switch ($this->type) {
-
- case DAV\Sharing\Plugin::INVITE_ACCEPTED :
- $writer->writeElement($cs . 'invite-accepted');
+ case DAV\Sharing\Plugin::INVITE_ACCEPTED:
+ $writer->writeElement($cs.'invite-accepted');
break;
- case DAV\Sharing\Plugin::INVITE_NORESPONSE :
- $writer->writeElement($cs . 'invite-noresponse');
+ case DAV\Sharing\Plugin::INVITE_NORESPONSE:
+ $writer->writeElement($cs.'invite-noresponse');
break;
-
}
- $writer->writeElement($cs . 'hosturl', [
- '{DAV:}href' => $writer->contextUri . $this->hostUrl
+ $writer->writeElement($cs.'hosturl', [
+ '{DAV:}href' => $writer->contextUri.$this->hostUrl,
]);
if ($this->summary) {
- $writer->writeElement($cs . 'summary', $this->summary);
+ $writer->writeElement($cs.'summary', $this->summary);
}
- $writer->startElement($cs . 'access');
+ $writer->startElement($cs.'access');
if ($this->readOnly) {
- $writer->writeElement($cs . 'read');
+ $writer->writeElement($cs.'read');
} else {
- $writer->writeElement($cs . 'read-write');
+ $writer->writeElement($cs.'read-write');
}
$writer->endElement(); // access
- $writer->startElement($cs . 'organizer');
+ $writer->startElement($cs.'organizer');
// If the organizer contains a 'mailto:' part, it means it should be
// treated as absolute.
- if (strtolower(substr($this->organizer, 0, 7)) === 'mailto:') {
+ if ('mailto:' === strtolower(substr($this->organizer, 0, 7))) {
$writer->writeElement('{DAV:}href', $this->organizer);
} else {
- $writer->writeElement('{DAV:}href', $writer->contextUri . $this->organizer);
+ $writer->writeElement('{DAV:}href', $writer->contextUri.$this->organizer);
}
if ($this->commonName) {
- $writer->writeElement($cs . 'common-name', $this->commonName);
+ $writer->writeElement($cs.'common-name', $this->commonName);
}
if ($this->firstName) {
- $writer->writeElement($cs . 'first-name', $this->firstName);
+ $writer->writeElement($cs.'first-name', $this->firstName);
}
if ($this->lastName) {
- $writer->writeElement($cs . 'last-name', $this->lastName);
+ $writer->writeElement($cs.'last-name', $this->lastName);
}
$writer->endElement(); // organizer
if ($this->commonName) {
- $writer->writeElement($cs . 'organizer-cn', $this->commonName);
+ $writer->writeElement($cs.'organizer-cn', $this->commonName);
}
if ($this->firstName) {
- $writer->writeElement($cs . 'organizer-first', $this->firstName);
+ $writer->writeElement($cs.'organizer-first', $this->firstName);
}
if ($this->lastName) {
- $writer->writeElement($cs . 'organizer-last', $this->lastName);
+ $writer->writeElement($cs.'organizer-last', $this->lastName);
}
if ($this->supportedComponents) {
- $writer->writeElement('{' . CalDAV\Plugin::NS_CALDAV . '}supported-calendar-component-set', $this->supportedComponents);
+ $writer->writeElement('{'.CalDAV\Plugin::NS_CALDAV.'}supported-calendar-component-set', $this->supportedComponents);
}
$writer->endElement(); // invite-notification
-
}
/**
- * Returns a unique id for this notification
+ * Returns a unique id for this notification.
*
* This is just the base url. This should generally be some kind of unique
* id.
*
* @return string
*/
- function getId() {
-
+ public function getId()
+ {
return $this->id;
-
}
/**
@@ -293,10 +287,8 @@ class Invite implements NotificationInterface {
*
* @return string
*/
- function getETag() {
-
+ public function getETag()
+ {
return $this->etag;
-
}
-
}
diff --git a/vendor/sabre/dav/lib/CalDAV/Xml/Notification/InviteReply.php b/vendor/sabre/dav/lib/CalDAV/Xml/Notification/InviteReply.php
index f4b10a396..abcbde151 100644
--- a/vendor/sabre/dav/lib/CalDAV/Xml/Notification/InviteReply.php
+++ b/vendor/sabre/dav/lib/CalDAV/Xml/Notification/InviteReply.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CalDAV\Xml\Notification;
use Sabre\CalDAV;
@@ -14,19 +16,19 @@ use Sabre\Xml\Writer;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-class InviteReply implements NotificationInterface {
-
+class InviteReply implements NotificationInterface
+{
/**
- * A unique id for the message
+ * A unique id for the message.
*
* @var string
*/
protected $id;
/**
- * Timestamp of the notification
+ * Timestamp of the notification.
*
- * @var DateTime
+ * @var \DateTime
*/
protected $dtStamp;
@@ -59,14 +61,14 @@ class InviteReply implements NotificationInterface {
protected $hostUrl;
/**
- * A description of the share request
+ * A description of the share request.
*
* @var string
*/
protected $summary;
/**
- * Notification Etag
+ * Notification Etag.
*
* @var string
*/
@@ -90,8 +92,8 @@ class InviteReply implements NotificationInterface {
*
* @param array $values
*/
- function __construct(array $values) {
-
+ public function __construct(array $values)
+ {
$required = [
'id',
'etag',
@@ -103,17 +105,16 @@ class InviteReply implements NotificationInterface {
];
foreach ($required as $item) {
if (!isset($values[$item])) {
- throw new \InvalidArgumentException($item . ' is a required constructor option');
+ throw new \InvalidArgumentException($item.' is a required constructor option');
}
}
foreach ($values as $key => $value) {
if (!property_exists($this, $key)) {
- throw new \InvalidArgumentException('Unknown option: ' . $key);
+ throw new \InvalidArgumentException('Unknown option: '.$key);
}
$this->$key = $value;
}
-
}
/**
@@ -133,12 +134,10 @@ class InviteReply implements NotificationInterface {
* If you are opening new elements, you must also close them again.
*
* @param Writer $writer
- * @return void
*/
- function xmlSerialize(Writer $writer) {
-
- $writer->writeElement('{' . CalDAV\Plugin::NS_CALENDARSERVER . '}invite-reply');
-
+ public function xmlSerialize(Writer $writer)
+ {
+ $writer->writeElement('{'.CalDAV\Plugin::NS_CALENDARSERVER.'}invite-reply');
}
/**
@@ -146,55 +145,50 @@ class InviteReply implements NotificationInterface {
* response body.
*
* @param Writer $writer
- * @return void
*/
- function xmlSerializeFull(Writer $writer) {
+ public function xmlSerializeFull(Writer $writer)
+ {
+ $cs = '{'.CalDAV\Plugin::NS_CALENDARSERVER.'}';
- $cs = '{' . CalDAV\Plugin::NS_CALENDARSERVER . '}';
+ $this->dtStamp->setTimezone(new \DateTimeZone('GMT'));
+ $writer->writeElement($cs.'dtstamp', $this->dtStamp->format('Ymd\\THis\\Z'));
- $this->dtStamp->setTimezone(new \DateTimezone('GMT'));
- $writer->writeElement($cs . 'dtstamp', $this->dtStamp->format('Ymd\\THis\\Z'));
+ $writer->startElement($cs.'invite-reply');
- $writer->startElement($cs . 'invite-reply');
-
- $writer->writeElement($cs . 'uid', $this->id);
- $writer->writeElement($cs . 'in-reply-to', $this->inReplyTo);
+ $writer->writeElement($cs.'uid', $this->id);
+ $writer->writeElement($cs.'in-reply-to', $this->inReplyTo);
$writer->writeElement('{DAV:}href', $this->href);
switch ($this->type) {
-
- case DAV\Sharing\Plugin::INVITE_ACCEPTED :
- $writer->writeElement($cs . 'invite-accepted');
+ case DAV\Sharing\Plugin::INVITE_ACCEPTED:
+ $writer->writeElement($cs.'invite-accepted');
break;
- case DAV\Sharing\Plugin::INVITE_DECLINED :
- $writer->writeElement($cs . 'invite-declined');
+ case DAV\Sharing\Plugin::INVITE_DECLINED:
+ $writer->writeElement($cs.'invite-declined');
break;
-
}
- $writer->writeElement($cs . 'hosturl', [
- '{DAV:}href' => $writer->contextUri . $this->hostUrl
+ $writer->writeElement($cs.'hosturl', [
+ '{DAV:}href' => $writer->contextUri.$this->hostUrl,
]);
if ($this->summary) {
- $writer->writeElement($cs . 'summary', $this->summary);
+ $writer->writeElement($cs.'summary', $this->summary);
}
$writer->endElement(); // invite-reply
-
}
/**
- * Returns a unique id for this notification
+ * Returns a unique id for this notification.
*
* This is just the base url. This should generally be some kind of unique
* id.
*
* @return string
*/
- function getId() {
-
+ public function getId()
+ {
return $this->id;
-
}
/**
@@ -204,10 +198,8 @@ class InviteReply implements NotificationInterface {
*
* @return string
*/
- function getETag() {
-
+ public function getETag()
+ {
return $this->etag;
-
}
-
}
diff --git a/vendor/sabre/dav/lib/CalDAV/Xml/Notification/NotificationInterface.php b/vendor/sabre/dav/lib/CalDAV/Xml/Notification/NotificationInterface.php
index b98f9c888..be7490533 100644
--- a/vendor/sabre/dav/lib/CalDAV/Xml/Notification/NotificationInterface.php
+++ b/vendor/sabre/dav/lib/CalDAV/Xml/Notification/NotificationInterface.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CalDAV\Xml\Notification;
use Sabre\Xml\Writer;
@@ -12,26 +14,25 @@ use Sabre\Xml\XmlSerializable;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-interface NotificationInterface extends XmlSerializable {
-
+interface NotificationInterface extends XmlSerializable
+{
/**
* This method serializes the entire notification, as it is used in the
* response body.
*
* @param Writer $writer
- * @return void
*/
- function xmlSerializeFull(Writer $writer);
+ public function xmlSerializeFull(Writer $writer);
/**
- * Returns a unique id for this notification
+ * Returns a unique id for this notification.
*
* This is just the base url. This should generally be some kind of unique
* id.
*
* @return string
*/
- function getId();
+ public function getId();
/**
* Returns the ETag for this notification.
@@ -40,6 +41,5 @@ interface NotificationInterface extends XmlSerializable {
*
* @return string
*/
- function getETag();
-
+ public function getETag();
}
diff --git a/vendor/sabre/dav/lib/CalDAV/Xml/Notification/SystemStatus.php b/vendor/sabre/dav/lib/CalDAV/Xml/Notification/SystemStatus.php
index 8c945dd68..3c656df34 100644
--- a/vendor/sabre/dav/lib/CalDAV/Xml/Notification/SystemStatus.php
+++ b/vendor/sabre/dav/lib/CalDAV/Xml/Notification/SystemStatus.php
@@ -1,12 +1,14 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CalDAV\Xml\Notification;
use Sabre\CalDAV\Plugin;
use Sabre\Xml\Writer;
/**
- * SystemStatus notification
+ * SystemStatus notification.
*
* This notification can be used to indicate to the user that the system is
* down.
@@ -15,14 +17,14 @@ use Sabre\Xml\Writer;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-class SystemStatus implements NotificationInterface {
-
+class SystemStatus implements NotificationInterface
+{
const TYPE_LOW = 1;
const TYPE_MEDIUM = 2;
const TYPE_HIGH = 3;
/**
- * A unique id
+ * A unique id.
*
* @var string
*/
@@ -50,7 +52,7 @@ class SystemStatus implements NotificationInterface {
protected $href;
/**
- * Notification Etag
+ * Notification Etag.
*
* @var string
*/
@@ -64,18 +66,17 @@ class SystemStatus implements NotificationInterface {
*
* @param string $id
* @param string $etag
- * @param int $type
+ * @param int $type
* @param string $description
* @param string $href
*/
- function __construct($id, $etag, $type = self::TYPE_HIGH, $description = null, $href = null) {
-
+ public function __construct($id, $etag, $type = self::TYPE_HIGH, $description = null, $href = null)
+ {
$this->id = $id;
$this->type = $type;
$this->description = $description;
$this->href = $href;
$this->etag = $etag;
-
}
/**
@@ -91,27 +92,25 @@ class SystemStatus implements NotificationInterface {
* responsible for closing them.
*
* @param Writer $writer
- * @return void
*/
- function xmlSerialize(Writer $writer) {
-
+ public function xmlSerialize(Writer $writer)
+ {
switch ($this->type) {
- case self::TYPE_LOW :
+ case self::TYPE_LOW:
$type = 'low';
break;
- case self::TYPE_MEDIUM :
+ case self::TYPE_MEDIUM:
$type = 'medium';
break;
- default :
- case self::TYPE_HIGH :
+ default:
+ case self::TYPE_HIGH:
$type = 'high';
break;
}
- $writer->startElement('{' . Plugin::NS_CALENDARSERVER . '}systemstatus');
+ $writer->startElement('{'.Plugin::NS_CALENDARSERVER.'}systemstatus');
$writer->writeAttribute('type', $type);
$writer->endElement();
-
}
/**
@@ -119,51 +118,47 @@ class SystemStatus implements NotificationInterface {
* response body.
*
* @param Writer $writer
- * @return void
*/
- function xmlSerializeFull(Writer $writer) {
-
- $cs = '{' . Plugin::NS_CALENDARSERVER . '}';
+ public function xmlSerializeFull(Writer $writer)
+ {
+ $cs = '{'.Plugin::NS_CALENDARSERVER.'}';
switch ($this->type) {
- case self::TYPE_LOW :
+ case self::TYPE_LOW:
$type = 'low';
break;
- case self::TYPE_MEDIUM :
+ case self::TYPE_MEDIUM:
$type = 'medium';
break;
- default :
- case self::TYPE_HIGH :
+ default:
+ case self::TYPE_HIGH:
$type = 'high';
break;
}
- $writer->startElement($cs . 'systemstatus');
+ $writer->startElement($cs.'systemstatus');
$writer->writeAttribute('type', $type);
-
if ($this->description) {
- $writer->writeElement($cs . 'description', $this->description);
+ $writer->writeElement($cs.'description', $this->description);
}
if ($this->href) {
$writer->writeElement('{DAV:}href', $this->href);
}
$writer->endElement(); // systemstatus
-
}
/**
- * Returns a unique id for this notification
+ * Returns a unique id for this notification.
*
* This is just the base url. This should generally be some kind of unique
* id.
*
* @return string
*/
- function getId() {
-
+ public function getId()
+ {
return $this->id;
-
}
/*
@@ -173,10 +168,8 @@ class SystemStatus implements NotificationInterface {
*
* @return string
*/
- function getETag() {
-
+ public function getETag()
+ {
return $this->etag;
-
}
-
}
diff --git a/vendor/sabre/dav/lib/CalDAV/Xml/Property/AllowedSharingModes.php b/vendor/sabre/dav/lib/CalDAV/Xml/Property/AllowedSharingModes.php
index 54e5a116a..224f52c96 100644
--- a/vendor/sabre/dav/lib/CalDAV/Xml/Property/AllowedSharingModes.php
+++ b/vendor/sabre/dav/lib/CalDAV/Xml/Property/AllowedSharingModes.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CalDAV\Xml\Property;
use Sabre\CalDAV\Plugin;
@@ -7,7 +9,7 @@ use Sabre\Xml\Writer;
use Sabre\Xml\XmlSerializable;
/**
- * AllowedSharingModes
+ * AllowedSharingModes.
*
* This property encodes the 'allowed-sharing-modes' property, as defined by
* the 'caldav-sharing-02' spec, in the http://calendarserver.org/ns/
@@ -18,14 +20,15 @@ use Sabre\Xml\XmlSerializable;
* such as VEVENT, VTODO
*
* @see https://trac.calendarserver.org/browser/CalendarServer/trunk/doc/Extensions/caldav-sharing-02.txt
+ *
* @copyright Copyright (C) fruux GmbH (https://fruux.com/)
* @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://sabre.io/license/ Modified BSD License
*/
-class AllowedSharingModes implements XmlSerializable {
-
+class AllowedSharingModes implements XmlSerializable
+{
/**
- * Whether or not a calendar can be shared with another user
+ * Whether or not a calendar can be shared with another user.
*
* @var bool
*/
@@ -39,17 +42,15 @@ class AllowedSharingModes implements XmlSerializable {
protected $canBePublished;
/**
- * Constructor
+ * Constructor.
*
* @param bool $canBeShared
* @param bool $canBePublished
- * @return void
*/
- function __construct($canBeShared, $canBePublished) {
-
+ public function __construct($canBeShared, $canBePublished)
+ {
$this->canBeShared = $canBeShared;
$this->canBePublished = $canBePublished;
-
}
/**
@@ -69,19 +70,14 @@ class AllowedSharingModes implements XmlSerializable {
* If you are opening new elements, you must also close them again.
*
* @param Writer $writer
- * @return void
*/
- function xmlSerialize(Writer $writer) {
-
+ public function xmlSerialize(Writer $writer)
+ {
if ($this->canBeShared) {
- $writer->writeElement('{' . Plugin::NS_CALENDARSERVER . '}can-be-shared');
+ $writer->writeElement('{'.Plugin::NS_CALENDARSERVER.'}can-be-shared');
}
if ($this->canBePublished) {
- $writer->writeElement('{' . Plugin::NS_CALENDARSERVER . '}can-be-published');
+ $writer->writeElement('{'.Plugin::NS_CALENDARSERVER.'}can-be-published');
}
-
}
-
-
-
}
diff --git a/vendor/sabre/dav/lib/CalDAV/Xml/Property/EmailAddressSet.php b/vendor/sabre/dav/lib/CalDAV/Xml/Property/EmailAddressSet.php
index fc6f1d505..6b28d5df2 100644
--- a/vendor/sabre/dav/lib/CalDAV/Xml/Property/EmailAddressSet.php
+++ b/vendor/sabre/dav/lib/CalDAV/Xml/Property/EmailAddressSet.php
@@ -1,12 +1,14 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CalDAV\Xml\Property;
use Sabre\Xml\Writer;
use Sabre\Xml\XmlSerializable;
/**
- * email-address-set property
+ * email-address-set property.
*
* This property represents the email-address-set property in the
* http://calendarserver.org/ns/ namespace.
@@ -17,35 +19,33 @@ use Sabre\Xml\XmlSerializable;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-class EmailAddressSet implements XmlSerializable {
-
+class EmailAddressSet implements XmlSerializable
+{
/**
- * emails
+ * emails.
*
* @var array
*/
private $emails;
/**
- * __construct
+ * __construct.
*
* @param array $emails
*/
- function __construct(array $emails) {
-
+ public function __construct(array $emails)
+ {
$this->emails = $emails;
-
}
/**
- * Returns the email addresses
+ * Returns the email addresses.
*
* @return array
*/
- function getValue() {
-
+ public function getValue()
+ {
return $this->emails;
-
}
/**
@@ -65,16 +65,11 @@ class EmailAddressSet implements XmlSerializable {
* If you are opening new elements, you must also close them again.
*
* @param Writer $writer
- * @return void
*/
- function xmlSerialize(Writer $writer) {
-
+ public function xmlSerialize(Writer $writer)
+ {
foreach ($this->emails as $email) {
-
$writer->writeElement('{http://calendarserver.org/ns/}email-address', $email);
-
}
-
}
-
}
diff --git a/vendor/sabre/dav/lib/CalDAV/Xml/Property/Invite.php b/vendor/sabre/dav/lib/CalDAV/Xml/Property/Invite.php
index 4f33c464c..db456617c 100644
--- a/vendor/sabre/dav/lib/CalDAV/Xml/Property/Invite.php
+++ b/vendor/sabre/dav/lib/CalDAV/Xml/Property/Invite.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CalDAV\Xml\Property;
use Sabre\CalDAV\Plugin;
@@ -9,19 +11,20 @@ use Sabre\Xml\Writer;
use Sabre\Xml\XmlSerializable;
/**
- * Invite property
+ * Invite property.
*
* This property encodes the 'invite' property, as defined by
* the 'caldav-sharing-02' spec, in the http://calendarserver.org/ns/
* namespace.
*
* @see https://trac.calendarserver.org/browser/CalendarServer/trunk/doc/Extensions/caldav-sharing-02.txt
+ *
* @copyright Copyright (C) fruux GmbH (https://fruux.com/)
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-class Invite implements XmlSerializable {
-
+class Invite implements XmlSerializable
+{
/**
* The list of users a calendar has been shared to.
*
@@ -34,10 +37,9 @@ class Invite implements XmlSerializable {
*
* @param Sharee[] $sharees
*/
- function __construct(array $sharees) {
-
+ public function __construct(array $sharees)
+ {
$this->sharees = $sharees;
-
}
/**
@@ -45,10 +47,9 @@ class Invite implements XmlSerializable {
*
* @return array
*/
- function getValue() {
-
+ public function getValue()
+ {
return $this->sharees;
-
}
/**
@@ -68,61 +69,54 @@ class Invite implements XmlSerializable {
* If you are opening new elements, you must also close them again.
*
* @param Writer $writer
- * @return void
*/
- function xmlSerialize(Writer $writer) {
-
- $cs = '{' . Plugin::NS_CALENDARSERVER . '}';
+ public function xmlSerialize(Writer $writer)
+ {
+ $cs = '{'.Plugin::NS_CALENDARSERVER.'}';
foreach ($this->sharees as $sharee) {
-
- if ($sharee->access === DAV\Sharing\Plugin::ACCESS_SHAREDOWNER) {
- $writer->startElement($cs . 'organizer');
+ if (DAV\Sharing\Plugin::ACCESS_SHAREDOWNER === $sharee->access) {
+ $writer->startElement($cs.'organizer');
} else {
- $writer->startElement($cs . 'user');
+ $writer->startElement($cs.'user');
switch ($sharee->inviteStatus) {
- case DAV\Sharing\Plugin::INVITE_ACCEPTED :
- $writer->writeElement($cs . 'invite-accepted');
+ case DAV\Sharing\Plugin::INVITE_ACCEPTED:
+ $writer->writeElement($cs.'invite-accepted');
break;
- case DAV\Sharing\Plugin::INVITE_DECLINED :
- $writer->writeElement($cs . 'invite-declined');
+ case DAV\Sharing\Plugin::INVITE_DECLINED:
+ $writer->writeElement($cs.'invite-declined');
break;
- case DAV\Sharing\Plugin::INVITE_NORESPONSE :
- $writer->writeElement($cs . 'invite-noresponse');
+ case DAV\Sharing\Plugin::INVITE_NORESPONSE:
+ $writer->writeElement($cs.'invite-noresponse');
break;
- case DAV\Sharing\Plugin::INVITE_INVALID :
- $writer->writeElement($cs . 'invite-invalid');
+ case DAV\Sharing\Plugin::INVITE_INVALID:
+ $writer->writeElement($cs.'invite-invalid');
break;
}
- $writer->startElement($cs . 'access');
+ $writer->startElement($cs.'access');
switch ($sharee->access) {
- case DAV\Sharing\Plugin::ACCESS_READWRITE :
- $writer->writeElement($cs . 'read-write');
+ case DAV\Sharing\Plugin::ACCESS_READWRITE:
+ $writer->writeElement($cs.'read-write');
break;
- case DAV\Sharing\Plugin::ACCESS_READ :
- $writer->writeElement($cs . 'read');
+ case DAV\Sharing\Plugin::ACCESS_READ:
+ $writer->writeElement($cs.'read');
break;
-
}
$writer->endElement(); // access
-
}
$href = new DAV\Xml\Property\Href($sharee->href);
$href->xmlSerialize($writer);
if (isset($sharee->properties['{DAV:}displayname'])) {
- $writer->writeElement($cs . 'common-name', $sharee->properties['{DAV:}displayname']);
+ $writer->writeElement($cs.'common-name', $sharee->properties['{DAV:}displayname']);
}
if ($sharee->comment) {
- $writer->writeElement($cs . 'summary', $sharee->comment);
+ $writer->writeElement($cs.'summary', $sharee->comment);
}
$writer->endElement(); // organizer or user
-
}
-
}
-
}
diff --git a/vendor/sabre/dav/lib/CalDAV/Xml/Property/ScheduleCalendarTransp.php b/vendor/sabre/dav/lib/CalDAV/Xml/Property/ScheduleCalendarTransp.php
index 10c20be55..780907169 100644
--- a/vendor/sabre/dav/lib/CalDAV/Xml/Property/ScheduleCalendarTransp.php
+++ b/vendor/sabre/dav/lib/CalDAV/Xml/Property/ScheduleCalendarTransp.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CalDAV\Xml\Property;
use Sabre\CalDAV\Plugin;
@@ -24,41 +26,39 @@ use Sabre\Xml\Writer;
* @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://sabre.io/license/ Modified BSD License
*/
-class ScheduleCalendarTransp implements Element {
-
+class ScheduleCalendarTransp implements Element
+{
const TRANSPARENT = 'transparent';
const OPAQUE = 'opaque';
/**
- * value
+ * value.
*
* @var string
*/
protected $value;
/**
- * Creates the property
+ * Creates the property.
*
* @param string $value
*/
- function __construct($value) {
-
- if ($value !== self::TRANSPARENT && $value !== self::OPAQUE) {
+ public function __construct($value)
+ {
+ if (self::TRANSPARENT !== $value && self::OPAQUE !== $value) {
throw new \InvalidArgumentException('The value must either be specified as "transparent" or "opaque"');
}
$this->value = $value;
-
}
/**
- * Returns the current value
+ * Returns the current value.
*
* @return string
*/
- function getValue() {
-
+ public function getValue()
+ {
return $this->value;
-
}
/**
@@ -78,19 +78,17 @@ class ScheduleCalendarTransp implements Element {
* If you are opening new elements, you must also close them again.
*
* @param Writer $writer
- * @return void
*/
- function xmlSerialize(Writer $writer) {
-
+ public function xmlSerialize(Writer $writer)
+ {
switch ($this->value) {
- case self::TRANSPARENT :
- $writer->writeElement('{' . Plugin::NS_CALDAV . '}transparent');
+ case self::TRANSPARENT:
+ $writer->writeElement('{'.Plugin::NS_CALDAV.'}transparent');
break;
- case self::OPAQUE :
- $writer->writeElement('{' . Plugin::NS_CALDAV . '}opaque');
+ case self::OPAQUE:
+ $writer->writeElement('{'.Plugin::NS_CALDAV.'}opaque');
break;
}
-
}
/**
@@ -112,10 +110,11 @@ class ScheduleCalendarTransp implements Element {
* the next element.
*
* @param Reader $reader
+ *
* @return mixed
*/
- static function xmlDeserialize(Reader $reader) {
-
+ public static function xmlDeserialize(Reader $reader)
+ {
$elems = Deserializer\enum($reader, Plugin::NS_CALDAV);
if (in_array('transparent', $elems)) {
@@ -123,8 +122,7 @@ class ScheduleCalendarTransp implements Element {
} else {
$value = self::OPAQUE;
}
- return new self($value);
+ return new self($value);
}
-
}
diff --git a/vendor/sabre/dav/lib/CalDAV/Xml/Property/SupportedCalendarComponentSet.php b/vendor/sabre/dav/lib/CalDAV/Xml/Property/SupportedCalendarComponentSet.php
index 7fc25c5f0..56fa61b13 100644
--- a/vendor/sabre/dav/lib/CalDAV/Xml/Property/SupportedCalendarComponentSet.php
+++ b/vendor/sabre/dav/lib/CalDAV/Xml/Property/SupportedCalendarComponentSet.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CalDAV\Xml\Property;
use Sabre\CalDAV\Plugin;
@@ -21,8 +23,8 @@ use Sabre\Xml\Writer;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-class SupportedCalendarComponentSet implements Element {
-
+class SupportedCalendarComponentSet implements Element
+{
/**
* List of supported components.
*
@@ -37,21 +39,19 @@ class SupportedCalendarComponentSet implements Element {
*
* @param array $components
*/
- function __construct(array $components) {
-
+ public function __construct(array $components)
+ {
$this->components = $components;
-
}
/**
- * Returns the list of supported components
+ * Returns the list of supported components.
*
* @return array
*/
- function getValue() {
-
+ public function getValue()
+ {
return $this->components;
-
}
/**
@@ -71,18 +71,14 @@ class SupportedCalendarComponentSet implements Element {
* If you are opening new elements, you must also close them again.
*
* @param Writer $writer
- * @return void
*/
- function xmlSerialize(Writer $writer) {
-
+ public function xmlSerialize(Writer $writer)
+ {
foreach ($this->components as $component) {
-
- $writer->startElement('{' . Plugin::NS_CALDAV . '}comp');
+ $writer->startElement('{'.Plugin::NS_CALDAV.'}comp');
$writer->writeAttributes(['name' => $component]);
$writer->endElement();
-
}
-
}
/**
@@ -104,16 +100,17 @@ class SupportedCalendarComponentSet implements Element {
* the next element.
*
* @param Reader $reader
+ *
* @return mixed
*/
- static function xmlDeserialize(Reader $reader) {
-
+ public static function xmlDeserialize(Reader $reader)
+ {
$elems = $reader->parseInnerTree();
$components = [];
- foreach ((array)$elems as $elem) {
- if ($elem['name'] === '{' . Plugin::NS_CALDAV . '}comp') {
+ foreach ((array) $elems as $elem) {
+ if ($elem['name'] === '{'.Plugin::NS_CALDAV.'}comp') {
$components[] = $elem['attributes']['name'];
}
}
@@ -123,7 +120,5 @@ class SupportedCalendarComponentSet implements Element {
}
return new self($components);
-
}
-
}
diff --git a/vendor/sabre/dav/lib/CalDAV/Xml/Property/SupportedCalendarData.php b/vendor/sabre/dav/lib/CalDAV/Xml/Property/SupportedCalendarData.php
index d123ba4c0..1c9c4779f 100644
--- a/vendor/sabre/dav/lib/CalDAV/Xml/Property/SupportedCalendarData.php
+++ b/vendor/sabre/dav/lib/CalDAV/Xml/Property/SupportedCalendarData.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CalDAV\Xml\Property;
use Sabre\CalDAV\Plugin;
@@ -7,7 +9,7 @@ use Sabre\Xml\Writer;
use Sabre\Xml\XmlSerializable;
/**
- * Supported-calendar-data property
+ * Supported-calendar-data property.
*
* This property is a representation of the supported-calendar-data property
* in the CalDAV namespace. SabreDAV only has support for text/calendar;2.0
@@ -20,8 +22,8 @@ use Sabre\Xml\XmlSerializable;
* @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://sabre.io/license/ Modified BSD License
*/
-class SupportedCalendarData implements XmlSerializable {
-
+class SupportedCalendarData implements XmlSerializable
+{
/**
* The xmlSerialize method is called during xml writing.
*
@@ -39,22 +41,19 @@ class SupportedCalendarData implements XmlSerializable {
* If you are opening new elements, you must also close them again.
*
* @param Writer $writer
- * @return void
*/
- function xmlSerialize(Writer $writer) {
-
- $writer->startElement('{' . Plugin::NS_CALDAV . '}calendar-data');
+ public function xmlSerialize(Writer $writer)
+ {
+ $writer->startElement('{'.Plugin::NS_CALDAV.'}calendar-data');
$writer->writeAttributes([
'content-type' => 'text/calendar',
- 'version' => '2.0',
+ 'version' => '2.0',
]);
$writer->endElement(); // calendar-data
- $writer->startElement('{' . Plugin::NS_CALDAV . '}calendar-data');
+ $writer->startElement('{'.Plugin::NS_CALDAV.'}calendar-data');
$writer->writeAttributes([
'content-type' => 'application/calendar+json',
]);
$writer->endElement(); // calendar-data
-
}
-
}
diff --git a/vendor/sabre/dav/lib/CalDAV/Xml/Property/SupportedCollationSet.php b/vendor/sabre/dav/lib/CalDAV/Xml/Property/SupportedCollationSet.php
index af10860d0..b88cd0d92 100644
--- a/vendor/sabre/dav/lib/CalDAV/Xml/Property/SupportedCollationSet.php
+++ b/vendor/sabre/dav/lib/CalDAV/Xml/Property/SupportedCollationSet.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CalDAV\Xml\Property;
use Sabre\CalDAV\Plugin;
@@ -7,7 +9,7 @@ use Sabre\Xml\Writer;
use Sabre\Xml\XmlSerializable;
/**
- * supported-collation-set property
+ * supported-collation-set property.
*
* This property is a representation of the supported-collation-set property
* in the CalDAV namespace.
@@ -19,8 +21,8 @@ use Sabre\Xml\XmlSerializable;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-class SupportedCollationSet implements XmlSerializable {
-
+class SupportedCollationSet implements XmlSerializable
+{
/**
* The xmlSerialize method is called during xml writing.
*
@@ -38,20 +40,17 @@ class SupportedCollationSet implements XmlSerializable {
* If you are opening new elements, you must also close them again.
*
* @param Writer $writer
- * @return void
*/
- function xmlSerialize(Writer $writer) {
-
+ public function xmlSerialize(Writer $writer)
+ {
$collations = [
'i;ascii-casemap',
'i;octet',
- 'i;unicode-casemap'
+ 'i;unicode-casemap',
];
foreach ($collations as $collation) {
- $writer->writeElement('{' . Plugin::NS_CALDAV . '}supported-collation', $collation);
+ $writer->writeElement('{'.Plugin::NS_CALDAV.'}supported-collation', $collation);
}
-
}
-
}
diff --git a/vendor/sabre/dav/lib/CalDAV/Xml/Request/CalendarMultiGetReport.php b/vendor/sabre/dav/lib/CalDAV/Xml/Request/CalendarMultiGetReport.php
index 6d3c5d508..8231de6bd 100644
--- a/vendor/sabre/dav/lib/CalDAV/Xml/Request/CalendarMultiGetReport.php
+++ b/vendor/sabre/dav/lib/CalDAV/Xml/Request/CalendarMultiGetReport.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CalDAV\Xml\Request;
use Sabre\CalDAV\Plugin;
@@ -19,8 +21,8 @@ use Sabre\Xml\XmlDeserializable;
* @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://sabre.io/license/ Modified BSD License
*/
-class CalendarMultiGetReport implements XmlDeserializable {
-
+class CalendarMultiGetReport implements XmlDeserializable
+{
/**
* An array with requested properties.
*
@@ -80,36 +82,33 @@ class CalendarMultiGetReport implements XmlDeserializable {
* the next element.
*
* @param Reader $reader
+ *
* @return mixed
*/
- static function xmlDeserialize(Reader $reader) {
-
+ public static function xmlDeserialize(Reader $reader)
+ {
$elems = $reader->parseInnerTree([
'{urn:ietf:params:xml:ns:caldav}calendar-data' => 'Sabre\\CalDAV\\Xml\\Filter\\CalendarData',
- '{DAV:}prop' => 'Sabre\\Xml\\Element\\KeyValue',
+ '{DAV:}prop' => 'Sabre\\Xml\\Element\\KeyValue',
]);
$newProps = [
- 'hrefs' => [],
+ 'hrefs' => [],
'properties' => [],
];
foreach ($elems as $elem) {
-
switch ($elem['name']) {
-
- case '{DAV:}prop' :
+ case '{DAV:}prop':
$newProps['properties'] = array_keys($elem['value']);
- if (isset($elem['value']['{' . Plugin::NS_CALDAV . '}calendar-data'])) {
- $newProps += $elem['value']['{' . Plugin::NS_CALDAV . '}calendar-data'];
+ if (isset($elem['value']['{'.Plugin::NS_CALDAV.'}calendar-data'])) {
+ $newProps += $elem['value']['{'.Plugin::NS_CALDAV.'}calendar-data'];
}
break;
- case '{DAV:}href' :
+ case '{DAV:}href':
$newProps['hrefs'][] = Uri\resolve($reader->contextUri, $elem['value']);
break;
-
}
-
}
$obj = new self();
@@ -118,7 +117,5 @@ class CalendarMultiGetReport implements XmlDeserializable {
}
return $obj;
-
}
-
}
diff --git a/vendor/sabre/dav/lib/CalDAV/Xml/Request/CalendarQueryReport.php b/vendor/sabre/dav/lib/CalDAV/Xml/Request/CalendarQueryReport.php
index e0b1c7950..e85eccd2d 100644
--- a/vendor/sabre/dav/lib/CalDAV/Xml/Request/CalendarQueryReport.php
+++ b/vendor/sabre/dav/lib/CalDAV/Xml/Request/CalendarQueryReport.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CalDAV\Xml\Request;
use Sabre\CalDAV\Plugin;
@@ -19,8 +21,8 @@ use Sabre\Xml\XmlDeserializable;
* @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://sabre.io/license/ Modified BSD License
*/
-class CalendarQueryReport implements XmlDeserializable {
-
+class CalendarQueryReport implements XmlDeserializable
+{
/**
* An array with requested properties.
*
@@ -80,38 +82,39 @@ class CalendarQueryReport implements XmlDeserializable {
* the next element.
*
* @param Reader $reader
+ *
* @return mixed
*/
- static function xmlDeserialize(Reader $reader) {
-
+ public static function xmlDeserialize(Reader $reader)
+ {
$elems = $reader->parseInnerTree([
- '{urn:ietf:params:xml:ns:caldav}comp-filter' => 'Sabre\\CalDAV\\Xml\\Filter\\CompFilter',
- '{urn:ietf:params:xml:ns:caldav}prop-filter' => 'Sabre\\CalDAV\\Xml\\Filter\\PropFilter',
- '{urn:ietf:params:xml:ns:caldav}param-filter' => 'Sabre\\CalDAV\\Xml\\Filter\\ParamFilter',
+ '{urn:ietf:params:xml:ns:caldav}comp-filter' => 'Sabre\\CalDAV\\Xml\\Filter\\CompFilter',
+ '{urn:ietf:params:xml:ns:caldav}prop-filter' => 'Sabre\\CalDAV\\Xml\\Filter\\PropFilter',
+ '{urn:ietf:params:xml:ns:caldav}param-filter' => 'Sabre\\CalDAV\\Xml\\Filter\\ParamFilter',
'{urn:ietf:params:xml:ns:caldav}calendar-data' => 'Sabre\\CalDAV\\Xml\\Filter\\CalendarData',
- '{DAV:}prop' => 'Sabre\\Xml\\Element\\KeyValue',
+ '{DAV:}prop' => 'Sabre\\Xml\\Element\\KeyValue',
]);
$newProps = [
- 'filters' => null,
+ 'filters' => null,
'properties' => [],
];
- if (!is_array($elems)) $elems = [];
+ if (!is_array($elems)) {
+ $elems = [];
+ }
foreach ($elems as $elem) {
-
switch ($elem['name']) {
-
- case '{DAV:}prop' :
+ case '{DAV:}prop':
$newProps['properties'] = array_keys($elem['value']);
- if (isset($elem['value']['{' . Plugin::NS_CALDAV . '}calendar-data'])) {
- $newProps += $elem['value']['{' . Plugin::NS_CALDAV . '}calendar-data'];
+ if (isset($elem['value']['{'.Plugin::NS_CALDAV.'}calendar-data'])) {
+ $newProps += $elem['value']['{'.Plugin::NS_CALDAV.'}calendar-data'];
}
break;
- case '{' . Plugin::NS_CALDAV . '}filter' :
+ case '{'.Plugin::NS_CALDAV.'}filter':
foreach ($elem['value'] as $subElem) {
- if ($subElem['name'] === '{' . Plugin::NS_CALDAV . '}comp-filter') {
+ if ($subElem['name'] === '{'.Plugin::NS_CALDAV.'}comp-filter') {
if (!is_null($newProps['filters'])) {
throw new BadRequest('Only one top-level comp-filter may be defined');
}
@@ -119,21 +122,18 @@ class CalendarQueryReport implements XmlDeserializable {
}
}
break;
-
}
-
}
if (is_null($newProps['filters'])) {
- throw new BadRequest('The {' . Plugin::NS_CALDAV . '}filter element is required for this request');
+ throw new BadRequest('The {'.Plugin::NS_CALDAV.'}filter element is required for this request');
}
$obj = new self();
foreach ($newProps as $key => $value) {
$obj->$key = $value;
}
- return $obj;
+ return $obj;
}
-
}
diff --git a/vendor/sabre/dav/lib/CalDAV/Xml/Request/FreeBusyQueryReport.php b/vendor/sabre/dav/lib/CalDAV/Xml/Request/FreeBusyQueryReport.php
index 0f6c1e074..a4d98a8d4 100644
--- a/vendor/sabre/dav/lib/CalDAV/Xml/Request/FreeBusyQueryReport.php
+++ b/vendor/sabre/dav/lib/CalDAV/Xml/Request/FreeBusyQueryReport.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CalDAV\Xml\Request;
use Sabre\CalDAV\Plugin;
@@ -9,7 +11,7 @@ use Sabre\Xml\Reader;
use Sabre\Xml\XmlDeserializable;
/**
- * FreeBusyQueryReport
+ * FreeBusyQueryReport.
*
* This class parses the {DAV:}free-busy-query REPORT, as defined in:
*
@@ -19,19 +21,19 @@ use Sabre\Xml\XmlDeserializable;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-class FreeBusyQueryReport implements XmlDeserializable {
-
+class FreeBusyQueryReport implements XmlDeserializable
+{
/**
- * Starttime of report
+ * Starttime of report.
*
- * @var DateTime|null
+ * @var \DateTime|null
*/
public $start;
/**
- * End time of report
+ * End time of report.
*
- * @var DateTime|null
+ * @var \DateTime|null
*/
public $end;
@@ -54,22 +56,23 @@ class FreeBusyQueryReport implements XmlDeserializable {
* the next element.
*
* @param Reader $reader
+ *
* @return mixed
*/
- static function xmlDeserialize(Reader $reader) {
-
- $timeRange = '{' . Plugin::NS_CALDAV . '}time-range';
+ public static function xmlDeserialize(Reader $reader)
+ {
+ $timeRange = '{'.Plugin::NS_CALDAV.'}time-range';
$start = null;
$end = null;
- foreach ((array)$reader->parseInnerTree([]) as $elem) {
-
- if ($elem['name'] !== $timeRange) continue;
+ foreach ((array) $reader->parseInnerTree([]) as $elem) {
+ if ($elem['name'] !== $timeRange) {
+ continue;
+ }
$start = empty($elem['attributes']['start']) ?: $elem['attributes']['start'];
$end = empty($elem['attributes']['end']) ?: $elem['attributes']['end'];
-
}
if (!$start && !$end) {
throw new BadRequest('The freebusy report must have a time-range element');
@@ -85,7 +88,5 @@ class FreeBusyQueryReport implements XmlDeserializable {
$result->end = $end;
return $result;
-
}
-
}
diff --git a/vendor/sabre/dav/lib/CalDAV/Xml/Request/InviteReply.php b/vendor/sabre/dav/lib/CalDAV/Xml/Request/InviteReply.php
index db32cc6a5..710095bb2 100644
--- a/vendor/sabre/dav/lib/CalDAV/Xml/Request/InviteReply.php
+++ b/vendor/sabre/dav/lib/CalDAV/Xml/Request/InviteReply.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CalDAV\Xml\Request;
use Sabre\CalDAV\Plugin;
@@ -11,7 +13,7 @@ use Sabre\Xml\Reader;
use Sabre\Xml\XmlDeserializable;
/**
- * Invite-reply POST request parser
+ * Invite-reply POST request parser.
*
* This class parses the invite-reply POST request, as defined in:
*
@@ -21,8 +23,8 @@ use Sabre\Xml\XmlDeserializable;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-class InviteReply implements XmlDeserializable {
-
+class InviteReply implements XmlDeserializable
+{
/**
* The sharee calendar user address.
*
@@ -40,14 +42,14 @@ class InviteReply implements XmlDeserializable {
public $calendarUri;
/**
- * The id of the invite message that's being responded to
+ * The id of the invite message that's being responded to.
*
* @var string
*/
public $inReplyTo;
/**
- * An optional message
+ * An optional message.
*
* @var string
*/
@@ -61,22 +63,21 @@ class InviteReply implements XmlDeserializable {
public $status;
/**
- * Constructor
+ * Constructor.
*
* @param string $href
* @param string $calendarUri
* @param string $inReplyTo
* @param string $summary
- * @param int $status
+ * @param int $status
*/
- function __construct($href, $calendarUri, $inReplyTo, $summary, $status) {
-
+ public function __construct($href, $calendarUri, $inReplyTo, $summary, $status)
+ {
$this->href = $href;
$this->calendarUri = $calendarUri;
$this->inReplyTo = $inReplyTo;
$this->summary = $summary;
$this->status = $status;
-
}
/**
@@ -98,10 +99,11 @@ class InviteReply implements XmlDeserializable {
* the next element.
*
* @param Reader $reader
+ *
* @return mixed
*/
- static function xmlDeserialize(Reader $reader) {
-
+ public static function xmlDeserialize(Reader $reader)
+ {
$elems = KeyValue::xmlDeserialize($reader);
$href = null;
@@ -111,40 +113,35 @@ class InviteReply implements XmlDeserializable {
$status = null;
foreach ($elems as $name => $value) {
-
switch ($name) {
-
- case '{' . Plugin::NS_CALENDARSERVER . '}hosturl' :
+ case '{'.Plugin::NS_CALENDARSERVER.'}hosturl':
foreach ($value as $bla) {
- if ($bla['name'] === '{DAV:}href') {
+ if ('{DAV:}href' === $bla['name']) {
$calendarUri = $bla['value'];
}
}
break;
- case '{' . Plugin::NS_CALENDARSERVER . '}invite-accepted' :
+ case '{'.Plugin::NS_CALENDARSERVER.'}invite-accepted':
$status = DAV\Sharing\Plugin::INVITE_ACCEPTED;
break;
- case '{' . Plugin::NS_CALENDARSERVER . '}invite-declined' :
+ case '{'.Plugin::NS_CALENDARSERVER.'}invite-declined':
$status = DAV\Sharing\Plugin::INVITE_DECLINED;
break;
- case '{' . Plugin::NS_CALENDARSERVER . '}in-reply-to' :
+ case '{'.Plugin::NS_CALENDARSERVER.'}in-reply-to':
$inReplyTo = $value;
break;
- case '{' . Plugin::NS_CALENDARSERVER . '}summary' :
+ case '{'.Plugin::NS_CALENDARSERVER.'}summary':
$summary = $value;
break;
- case '{DAV:}href' :
+ case '{DAV:}href':
$href = $value;
break;
}
-
}
if (is_null($calendarUri)) {
throw new BadRequest('The {http://calendarserver.org/ns/}hosturl/{DAV:}href element must exist');
}
return new self($href, $calendarUri, $inReplyTo, $summary, $status);
-
}
-
}
diff --git a/vendor/sabre/dav/lib/CalDAV/Xml/Request/MkCalendar.php b/vendor/sabre/dav/lib/CalDAV/Xml/Request/MkCalendar.php
index ce7fafde9..7cad98da5 100644
--- a/vendor/sabre/dav/lib/CalDAV/Xml/Request/MkCalendar.php
+++ b/vendor/sabre/dav/lib/CalDAV/Xml/Request/MkCalendar.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CalDAV\Xml\Request;
use Sabre\Xml\Reader;
@@ -16,8 +18,8 @@ use Sabre\Xml\XmlDeserializable;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-class MkCalendar implements XmlDeserializable {
-
+class MkCalendar implements XmlDeserializable
+{
/**
* The list of properties that will be set.
*
@@ -30,10 +32,9 @@ class MkCalendar implements XmlDeserializable {
*
* @return array
*/
- function getProperties() {
-
+ public function getProperties()
+ {
return $this->properties;
-
}
/**
@@ -55,10 +56,11 @@ class MkCalendar implements XmlDeserializable {
* the next element.
*
* @param Reader $reader
+ *
* @return mixed
*/
- static function xmlDeserialize(Reader $reader) {
-
+ public static function xmlDeserialize(Reader $reader)
+ {
$self = new self();
$elementMap = $reader->elementMap;
@@ -67,13 +69,11 @@ class MkCalendar implements XmlDeserializable {
$elems = $reader->parseInnerTree($elementMap);
foreach ($elems as $elem) {
- if ($elem['name'] === '{DAV:}set') {
+ if ('{DAV:}set' === $elem['name']) {
$self->properties = array_merge($self->properties, $elem['value']['{DAV:}prop']);
}
}
return $self;
-
}
-
}
diff --git a/vendor/sabre/dav/lib/CalDAV/Xml/Request/Share.php b/vendor/sabre/dav/lib/CalDAV/Xml/Request/Share.php
index e0bd8e0af..60bd579d5 100644
--- a/vendor/sabre/dav/lib/CalDAV/Xml/Request/Share.php
+++ b/vendor/sabre/dav/lib/CalDAV/Xml/Request/Share.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CalDAV\Xml\Request;
use Sabre\CalDAV\Plugin;
@@ -8,7 +10,7 @@ use Sabre\Xml\Reader;
use Sabre\Xml\XmlDeserializable;
/**
- * Share POST request parser
+ * Share POST request parser.
*
* This class parses the share POST request, as defined in:
*
@@ -18,8 +20,8 @@ use Sabre\Xml\XmlDeserializable;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-class Share implements XmlDeserializable {
-
+class Share implements XmlDeserializable
+{
/**
* The list of new people added or updated or removed from the share.
*
@@ -28,14 +30,13 @@ class Share implements XmlDeserializable {
public $sharees = [];
/**
- * Constructor
+ * Constructor.
*
* @param Sharee[] $sharees
*/
- function __construct(array $sharees) {
-
+ public function __construct(array $sharees)
+ {
$this->sharees = $sharees;
-
}
/**
@@ -57,55 +58,52 @@ class Share implements XmlDeserializable {
* the next element.
*
* @param Reader $reader
+ *
* @return mixed
*/
- static function xmlDeserialize(Reader $reader) {
-
+ public static function xmlDeserialize(Reader $reader)
+ {
$elems = $reader->parseGetElements([
- '{' . Plugin::NS_CALENDARSERVER . '}set' => 'Sabre\\Xml\\Element\\KeyValue',
- '{' . Plugin::NS_CALENDARSERVER . '}remove' => 'Sabre\\Xml\\Element\\KeyValue',
+ '{'.Plugin::NS_CALENDARSERVER.'}set' => 'Sabre\\Xml\\Element\\KeyValue',
+ '{'.Plugin::NS_CALENDARSERVER.'}remove' => 'Sabre\\Xml\\Element\\KeyValue',
]);
$sharees = [];
foreach ($elems as $elem) {
switch ($elem['name']) {
-
- case '{' . Plugin::NS_CALENDARSERVER . '}set' :
+ case '{'.Plugin::NS_CALENDARSERVER.'}set':
$sharee = $elem['value'];
- $sumElem = '{' . Plugin::NS_CALENDARSERVER . '}summary';
- $commonName = '{' . Plugin::NS_CALENDARSERVER . '}common-name';
+ $sumElem = '{'.Plugin::NS_CALENDARSERVER.'}summary';
+ $commonName = '{'.Plugin::NS_CALENDARSERVER.'}common-name';
$properties = [];
if (isset($sharee[$commonName])) {
$properties['{DAV:}displayname'] = $sharee[$commonName];
}
- $access = array_key_exists('{' . Plugin::NS_CALENDARSERVER . '}read-write', $sharee)
+ $access = array_key_exists('{'.Plugin::NS_CALENDARSERVER.'}read-write', $sharee)
? \Sabre\DAV\Sharing\Plugin::ACCESS_READWRITE
: \Sabre\DAV\Sharing\Plugin::ACCESS_READ;
$sharees[] = new Sharee([
- 'href' => $sharee['{DAV:}href'],
+ 'href' => $sharee['{DAV:}href'],
'properties' => $properties,
- 'access' => $access,
- 'comment' => isset($sharee[$sumElem]) ? $sharee[$sumElem] : null
+ 'access' => $access,
+ 'comment' => isset($sharee[$sumElem]) ? $sharee[$sumElem] : null,
]);
break;
- case '{' . Plugin::NS_CALENDARSERVER . '}remove' :
+ case '{'.Plugin::NS_CALENDARSERVER.'}remove':
$sharees[] = new Sharee([
- 'href' => $elem['value']['{DAV:}href'],
- 'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_NOACCESS
+ 'href' => $elem['value']['{DAV:}href'],
+ 'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_NOACCESS,
]);
break;
-
}
}
return new self($sharees);
-
}
-
}