aboutsummaryrefslogtreecommitdiffstats
path: root/apps/dav/lib/Connector/Sabre/SharesPlugin.php
diff options
context:
space:
mode:
authorCarl Schwan <carl@carlschwan.eu>2022-04-12 14:01:13 +0200
committerCarl Schwan <carl@carlschwan.eu>2022-05-05 22:03:59 +0200
commit829490ab7a02579c6b31573c3f53428e86cbf2e0 (patch)
tree1f644d168039ea1875398234419ace13f49dac5f /apps/dav/lib/Connector/Sabre/SharesPlugin.php
parent0690646d09430ce363b07bc2cd59283e303314eb (diff)
downloadnextcloud-server-829490ab7a02579c6b31573c3f53428e86cbf2e0.tar.gz
nextcloud-server-829490ab7a02579c6b31573c3f53428e86cbf2e0.zip
Cleanup dav
- Remove unused class AppEnabledPlugin - Add more type hinting when possible Signed-off-by: Carl Schwan <carl@carlschwan.eu>
Diffstat (limited to 'apps/dav/lib/Connector/Sabre/SharesPlugin.php')
-rw-r--r--apps/dav/lib/Connector/Sabre/SharesPlugin.php50
1 files changed, 19 insertions, 31 deletions
diff --git a/apps/dav/lib/Connector/Sabre/SharesPlugin.php b/apps/dav/lib/Connector/Sabre/SharesPlugin.php
index 57c91e05a8c..9fa6775c3b5 100644
--- a/apps/dav/lib/Connector/Sabre/SharesPlugin.php
+++ b/apps/dav/lib/Connector/Sabre/SharesPlugin.php
@@ -30,10 +30,14 @@ namespace OCA\DAV\Connector\Sabre;
use OCA\DAV\Connector\Sabre\Node as DavNode;
use OCP\Files\Folder;
+use OCP\Files\Node;
use OCP\Files\NotFoundException;
use OCP\IUserSession;
use OCP\Share\IShare;
+use OCP\Share\IManager;
use Sabre\DAV\PropFind;
+use Sabre\DAV\Tree;
+use Sabre\DAV\Server;
/**
* Sabre Plugin to provide share-related properties
@@ -50,36 +54,20 @@ class SharesPlugin extends \Sabre\DAV\ServerPlugin {
* @var \Sabre\DAV\Server
*/
private $server;
-
- /** @var \OCP\Share\IManager */
- private $shareManager;
-
- /** @var \Sabre\DAV\Tree */
- private $tree;
-
- /** @var string */
- private $userId;
-
- /** @var \OCP\Files\Folder */
- private $userFolder;
-
+ private IManager $shareManager;
+ private Tree $tree;
+ private string $userId;
+ private Folder $userFolder;
/** @var IShare[][] */
- private $cachedShares = [];
-
+ private array $cachedShares = [];
/** @var string[] */
- private $cachedFolders = [];
+ private array $cachedFolders = [];
- /**
- * @param \Sabre\DAV\Tree $tree tree
- * @param IUserSession $userSession user session
- * @param \OCP\Files\Folder $userFolder user home folder
- * @param \OCP\Share\IManager $shareManager share manager
- */
public function __construct(
- \Sabre\DAV\Tree $tree,
+ Tree $tree,
IUserSession $userSession,
- \OCP\Files\Folder $userFolder,
- \OCP\Share\IManager $shareManager
+ Folder $userFolder,
+ IManager $shareManager
) {
$this->tree = $tree;
$this->shareManager = $shareManager;
@@ -95,9 +83,9 @@ class SharesPlugin extends \Sabre\DAV\ServerPlugin {
*
* This method should set up the required event subscriptions.
*
- * @param \Sabre\DAV\Server $server
+ * @return void
*/
- public function initialize(\Sabre\DAV\Server $server) {
+ public function initialize(Server $server) {
$server->xml->namespaceMap[self::NS_OWNCLOUD] = 'oc';
$server->xml->elementMap[self::SHARETYPES_PROPERTYNAME] = ShareTypeList::class;
$server->protectedProperties[] = self::SHARETYPES_PROPERTYNAME;
@@ -108,10 +96,10 @@ class SharesPlugin extends \Sabre\DAV\ServerPlugin {
}
/**
- * @param \OCP\Files\Node $node
+ * @param Node $node
* @return IShare[]
*/
- private function getShare(\OCP\Files\Node $node): array {
+ private function getShare(Node $node): array {
$result = [];
$requestedShareTypes = [
IShare::TYPE_USER,
@@ -209,7 +197,7 @@ class SharesPlugin extends \Sabre\DAV\ServerPlugin {
}
}
- $propFind->handle(self::SHARETYPES_PROPERTYNAME, function () use ($sabreNode) {
+ $propFind->handle(self::SHARETYPES_PROPERTYNAME, function () use ($sabreNode): ShareTypeList {
$shares = $this->getShares($sabreNode);
$shareTypes = array_unique(array_map(function (IShare $share) {
@@ -219,7 +207,7 @@ class SharesPlugin extends \Sabre\DAV\ServerPlugin {
return new ShareTypeList($shareTypes);
});
- $propFind->handle(self::SHAREES_PROPERTYNAME, function () use ($sabreNode) {
+ $propFind->handle(self::SHAREES_PROPERTYNAME, function () use ($sabreNode): ShareeList {
$shares = $this->getShares($sabreNode);
return new ShareeList($shares);