aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/sabre/dav/lib/DAV/Sync
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2019-11-10 12:49:51 +0000
committerMario <mario@mariovavti.com>2019-11-10 14:10:03 +0100
commit580c3f4ffe9608d2beb56d418c68b3b112420e76 (patch)
tree82335d01179ac361d3f547a4b8e8c598d302e9f3 /vendor/sabre/dav/lib/DAV/Sync
parentd22766f458a8539a40a57f3946459a9be1f21cd6 (diff)
downloadvolse-hubzilla-580c3f4ffe9608d2beb56d418c68b3b112420e76.tar.gz
volse-hubzilla-580c3f4ffe9608d2beb56d418c68b3b112420e76.tar.bz2
volse-hubzilla-580c3f4ffe9608d2beb56d418c68b3b112420e76.zip
another bulk of composer updates
(cherry picked from commit 6685381fd8db507493c3d7c1793f8c05c681bbce)
Diffstat (limited to 'vendor/sabre/dav/lib/DAV/Sync')
-rw-r--r--vendor/sabre/dav/lib/DAV/Sync/ISyncCollection.php16
-rw-r--r--vendor/sabre/dav/lib/DAV/Sync/Plugin.php112
2 files changed, 52 insertions, 76 deletions
diff --git a/vendor/sabre/dav/lib/DAV/Sync/ISyncCollection.php b/vendor/sabre/dav/lib/DAV/Sync/ISyncCollection.php
index d3dc28a80..4ca69dc89 100644
--- a/vendor/sabre/dav/lib/DAV/Sync/ISyncCollection.php
+++ b/vendor/sabre/dav/lib/DAV/Sync/ISyncCollection.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\DAV\Sync;
use Sabre\DAV;
@@ -15,8 +17,8 @@ use Sabre\DAV;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-interface ISyncCollection extends DAV\ICollection {
-
+interface ISyncCollection extends DAV\ICollection
+{
/**
* This method returns the current sync-token for this collection.
* This can be any string.
@@ -26,7 +28,7 @@ interface ISyncCollection extends DAV\ICollection {
*
* @return string|null
*/
- function getSyncToken();
+ public function getSyncToken();
/**
* The getChanges method returns all the changes that have happened, since
@@ -79,10 +81,10 @@ interface ISyncCollection extends DAV\ICollection {
* 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);
}
diff --git a/vendor/sabre/dav/lib/DAV/Sync/Plugin.php b/vendor/sabre/dav/lib/DAV/Sync/Plugin.php
index 8e4b1aa64..f76827fe3 100644
--- a/vendor/sabre/dav/lib/DAV/Sync/Plugin.php
+++ b/vendor/sabre/dav/lib/DAV/Sync/Plugin.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\DAV\Sync;
use Sabre\DAV;
@@ -18,10 +20,10 @@ use Sabre\HTTP\RequestInterface;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-class Plugin extends DAV\ServerPlugin {
-
+class Plugin extends DAV\ServerPlugin
+{
/**
- * Reference to server object
+ * Reference to server object.
*
* @var DAV\Server
*/
@@ -37,10 +39,9 @@ class Plugin extends DAV\ServerPlugin {
*
* @return string
*/
- function getPluginName() {
-
+ public function getPluginName()
+ {
return 'sync';
-
}
/**
@@ -49,28 +50,25 @@ class Plugin extends DAV\ServerPlugin {
* This is when the plugin registers it's hooks.
*
* @param DAV\Server $server
- * @return void
*/
- function initialize(DAV\Server $server) {
-
+ public function initialize(DAV\Server $server)
+ {
$this->server = $server;
$server->xml->elementMap['{DAV:}sync-collection'] = 'Sabre\\DAV\\Xml\\Request\\SyncCollectionReport';
$self = $this;
- $server->on('report', function($reportName, $dom, $uri) use ($self) {
-
- if ($reportName === '{DAV:}sync-collection') {
+ $server->on('report', function ($reportName, $dom, $uri) use ($self) {
+ if ('{DAV:}sync-collection' === $reportName) {
$this->server->transactionType = 'report-sync-collection';
$self->syncCollection($uri, $dom);
+
return false;
}
-
});
- $server->on('propFind', [$this, 'propFind']);
+ $server->on('propFind', [$this, 'propFind']);
$server->on('validateTokens', [$this, 'validateTokens']);
-
}
/**
@@ -81,10 +79,11 @@ 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);
if ($node instanceof ISyncCollection && $node->getSyncToken()) {
return [
@@ -93,19 +92,16 @@ class Plugin extends DAV\ServerPlugin {
}
return [];
-
}
-
/**
* This method handles the {DAV:}sync-collection HTTP REPORT.
*
- * @param string $uri
+ * @param string $uri
* @param SyncCollectionReport $report
- * @return void
*/
- function syncCollection($uri, SyncCollectionReport $report) {
-
+ public function syncCollection($uri, SyncCollectionReport $report)
+ {
// Getting the data
$node = $this->server->tree->getNodeForPath($uri);
if (!$node instanceof ISyncCollection) {
@@ -119,19 +115,16 @@ class Plugin extends DAV\ServerPlugin {
$syncToken = $report->syncToken;
if (!is_null($syncToken)) {
// Sync-token must start with our prefix
- if (substr($syncToken, 0, strlen(self::SYNCTOKEN_PREFIX)) !== self::SYNCTOKEN_PREFIX) {
+ if (self::SYNCTOKEN_PREFIX !== substr($syncToken, 0, strlen(self::SYNCTOKEN_PREFIX))) {
throw new DAV\Exception\InvalidSyncToken('Invalid or unknown sync token');
}
$syncToken = substr($syncToken, strlen(self::SYNCTOKEN_PREFIX));
-
}
$changeInfo = $node->getChanges($syncToken, $report->syncLevel, $report->limit);
if (is_null($changeInfo)) {
-
throw new DAV\Exception\InvalidSyncToken('Invalid or unknown sync token');
-
}
// Encoding the response
@@ -143,7 +136,6 @@ class Plugin extends DAV\ServerPlugin {
$changeInfo['deleted'],
$report->properties
);
-
}
/**
@@ -151,50 +143,41 @@ class Plugin extends DAV\ServerPlugin {
*
* @param string $syncToken
* @param string $collectionUrl
- * @param array $added
- * @param array $modified
- * @param array $deleted
- * @param array $properties
- * @return void
+ * @param array $added
+ * @param array $modified
+ * @param array $deleted
+ * @param array $properties
*/
- protected function sendSyncCollectionResponse($syncToken, $collectionUrl, array $added, array $modified, array $deleted, array $properties) {
-
-
+ protected function sendSyncCollectionResponse($syncToken, $collectionUrl, array $added, array $modified, array $deleted, array $properties)
+ {
$fullPaths = [];
// Pre-fetching children, if this is possible.
foreach (array_merge($added, $modified) as $item) {
- $fullPath = $collectionUrl . '/' . $item;
+ $fullPath = $collectionUrl.'/'.$item;
$fullPaths[] = $fullPath;
}
$responses = [];
foreach ($this->server->getPropertiesForMultiplePaths($fullPaths, $properties) as $fullPath => $props) {
-
// The 'Property_Response' class is responsible for generating a
// single {DAV:}response xml element.
$responses[] = new DAV\Xml\Element\Response($fullPath, $props);
-
}
-
-
// Deleted items also show up as 'responses'. They have no properties,
// and a single {DAV:}status element set as 'HTTP/1.1 404 Not Found'.
foreach ($deleted as $item) {
-
- $fullPath = $collectionUrl . '/' . $item;
+ $fullPath = $collectionUrl.'/'.$item;
$responses[] = new DAV\Xml\Element\Response($fullPath, [], 404);
-
}
- $multiStatus = new DAV\Xml\Response\MultiStatus($responses, self::SYNCTOKEN_PREFIX . $syncToken);
+ $multiStatus = new DAV\Xml\Response\MultiStatus($responses, self::SYNCTOKEN_PREFIX.$syncToken);
$this->server->httpResponse->setStatus(207);
$this->server->httpResponse->setHeader('Content-Type', 'application/xml; charset=utf-8');
$this->server->httpResponse->setBody(
$this->server->xml->write('{DAV:}multistatus', $multiStatus, $this->server->getBaseUri())
);
-
}
/**
@@ -202,18 +185,17 @@ class Plugin extends DAV\ServerPlugin {
* We intercept this to see if we must return a {DAV:}sync-token.
*
* @param DAV\PropFind $propFind
- * @param DAV\INode $node
- * @return void
+ * @param DAV\INode $node
*/
- function propFind(DAV\PropFind $propFind, DAV\INode $node) {
-
- $propFind->handle('{DAV:}sync-token', function() use ($node) {
+ public function propFind(DAV\PropFind $propFind, DAV\INode $node)
+ {
+ $propFind->handle('{DAV:}sync-token', function () use ($node) {
if (!$node instanceof ISyncCollection || !$token = $node->getSyncToken()) {
return;
}
- return self::SYNCTOKEN_PREFIX . $token;
- });
+ return self::SYNCTOKEN_PREFIX.$token;
+ });
}
/**
@@ -223,17 +205,14 @@ class Plugin extends DAV\ServerPlugin {
* in the If: header, and check if they are valid.
*
* @param RequestInterface $request
- * @param array $conditions
- * @return void
+ * @param array $conditions
*/
- function validateTokens(RequestInterface $request, &$conditions) {
-
+ public function validateTokens(RequestInterface $request, &$conditions)
+ {
foreach ($conditions as $kk => $condition) {
-
foreach ($condition['tokens'] as $ii => $token) {
-
// Sync-tokens must always start with our designated prefix.
- if (substr($token['token'], 0, strlen(self::SYNCTOKEN_PREFIX)) !== self::SYNCTOKEN_PREFIX) {
+ if (self::SYNCTOKEN_PREFIX !== substr($token['token'], 0, strlen(self::SYNCTOKEN_PREFIX))) {
continue;
}
@@ -246,11 +225,8 @@ class Plugin extends DAV\ServerPlugin {
) {
$conditions[$kk]['tokens'][$ii]['validToken'] = true;
}
-
}
-
}
-
}
/**
@@ -264,14 +240,12 @@ class Plugin extends DAV\ServerPlugin {
*
* @return array
*/
- function getPluginInfo() {
-
+ public function getPluginInfo()
+ {
return [
- 'name' => $this->getPluginName(),
+ 'name' => $this->getPluginName(),
'description' => 'Adds support for WebDAV Collection Sync (rfc6578)',
- 'link' => 'http://sabre.io/dav/sync/',
+ 'link' => 'http://sabre.io/dav/sync/',
];
-
}
-
}