aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/sabre/dav/lib/CalDAV/Notifications
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/sabre/dav/lib/CalDAV/Notifications')
-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
5 files changed, 85 insertions, 104 deletions
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/',
];
-
}
-
}