From 580c3f4ffe9608d2beb56d418c68b3b112420e76 Mon Sep 17 00:00:00 2001 From: Mario Date: Sun, 10 Nov 2019 12:49:51 +0000 Subject: another bulk of composer updates (cherry picked from commit 6685381fd8db507493c3d7c1793f8c05c681bbce) --- .../dav/lib/CalDAV/Notifications/Collection.php | 42 ++++++------- .../dav/lib/CalDAV/Notifications/ICollection.php | 6 +- .../sabre/dav/lib/CalDAV/Notifications/INode.php | 11 ++-- vendor/sabre/dav/lib/CalDAV/Notifications/Node.php | 59 ++++++++---------- .../sabre/dav/lib/CalDAV/Notifications/Plugin.php | 71 +++++++++------------- 5 files changed, 85 insertions(+), 104 deletions(-) (limited to 'vendor/sabre/dav/lib/CalDAV/Notifications') 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 @@ 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 @@ 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 @@ 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/', ]; - } - } -- cgit v1.2.3