summaryrefslogtreecommitdiffstats
path: root/apps/federatedfilesharing/lib/FederatedShareProvider.php
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2020-04-10 14:19:56 +0200
committerChristoph Wurst <christoph@winzerhof-wurst.at>2020-04-10 14:19:56 +0200
commitcaff1023ea72bb2ea94130e18a2a6e2ccf819e5f (patch)
tree186d494c2aea5dea7255d3584ef5d595fc6e6194 /apps/federatedfilesharing/lib/FederatedShareProvider.php
parentedf8ce32cffdb920e8171207b342abbd7f1fbe73 (diff)
downloadnextcloud-server-caff1023ea72bb2ea94130e18a2a6e2ccf819e5f.tar.gz
nextcloud-server-caff1023ea72bb2ea94130e18a2a6e2ccf819e5f.zip
Format control structures, classes, methods and function
To continue this formatting madness, here's a tiny patch that adds unified formatting for control structures like if and loops as well as classes, their methods and anonymous functions. This basically forces the constructs to start on the same line. This is not exactly what PSR2 wants, but I think we can have a few exceptions with "our" style. The starting of braces on the same line is pracrically standard for our code. This also removes and empty lines from method/function bodies at the beginning and end. Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'apps/federatedfilesharing/lib/FederatedShareProvider.php')
-rw-r--r--apps/federatedfilesharing/lib/FederatedShareProvider.php21
1 files changed, 7 insertions, 14 deletions
diff --git a/apps/federatedfilesharing/lib/FederatedShareProvider.php b/apps/federatedfilesharing/lib/FederatedShareProvider.php
index e1392b7a83a..aaa3e27cfd2 100644
--- a/apps/federatedfilesharing/lib/FederatedShareProvider.php
+++ b/apps/federatedfilesharing/lib/FederatedShareProvider.php
@@ -58,7 +58,6 @@ use OCP\Share\IShareProvider;
* @package OCA\FederatedFileSharing
*/
class FederatedShareProvider implements IShareProvider {
-
const SHARE_TYPE_REMOTE = 6;
/** @var IDBConnection */
@@ -165,7 +164,6 @@ class FederatedShareProvider implements IShareProvider {
* @throws \Exception
*/
public function create(IShare $share) {
-
$shareWith = $share->getSharedWith();
$itemSource = $share->getNodeId();
$itemType = $share->getNodeType();
@@ -237,7 +235,6 @@ class FederatedShareProvider implements IShareProvider {
$message_t = $this->l->t('File is already shared with %s', [$shareWith]);
throw new \Exception($message_t);
}
-
} else {
$shareId = $this->createFederatedShare($share);
}
@@ -300,7 +297,7 @@ class FederatedShareProvider implements IShareProvider {
$failure = true;
}
- if($failure) {
+ if ($failure) {
$this->removeShareFromTableById($shareId);
$message_t = $this->l->t('Sharing %1$s failed, could not find %2$s, maybe the server is currently unreachable or uses a self-signed certificate.',
[$share->getNode()->getName(), $share->getSharedWith()]);
@@ -308,7 +305,6 @@ class FederatedShareProvider implements IShareProvider {
}
return $shareId;
-
}
/**
@@ -319,7 +315,6 @@ class FederatedShareProvider implements IShareProvider {
* @throws \Exception
*/
protected function askOwnerToReShare($shareWith, IShare $share, $shareId) {
-
$remoteShare = $this->getShareFromExternalShareTable($share);
$token = $remoteShare['share_token'];
$remoteId = $remoteShare['remote_id'];
@@ -409,7 +404,7 @@ class FederatedShareProvider implements IShareProvider {
* We allow updating the permissions of federated shares
*/
$qb = $this->dbConnection->getQueryBuilder();
- $qb->update('share')
+ $qb->update('share')
->where($qb->expr()->eq('id', $qb->createNamedParameter($share->getId())))
->set('permissions', $qb->createNamedParameter($share->getPermissions()))
->set('uid_owner', $qb->createNamedParameter($share->getShareOwner()))
@@ -523,7 +518,7 @@ class FederatedShareProvider implements IShareProvider {
->orderBy('id');
$cursor = $qb->execute();
- while($data = $cursor->fetch()) {
+ while ($data = $cursor->fetch()) {
$children[] = $this->createShareObject($data);
}
$cursor->closeCursor();
@@ -539,7 +534,6 @@ class FederatedShareProvider implements IShareProvider {
* @throws \OC\HintException
*/
public function delete(IShare $share) {
-
list(, $remote) = $this->addressHandler->splitUserRemote($share->getSharedWith());
// if the local user is the owner we can send the unShare request directly...
@@ -714,7 +708,7 @@ class FederatedShareProvider implements IShareProvider {
$cursor = $qb->execute();
$shares = [];
- while($data = $cursor->fetch()) {
+ while ($data = $cursor->fetch()) {
$shares[] = $this->createShareObject($data);
}
$cursor->closeCursor();
@@ -767,7 +761,7 @@ class FederatedShareProvider implements IShareProvider {
->execute();
$shares = [];
- while($data = $cursor->fetch()) {
+ while ($data = $cursor->fetch()) {
$shares[] = $this->createShareObject($data);
}
$cursor->closeCursor();
@@ -806,7 +800,7 @@ class FederatedShareProvider implements IShareProvider {
$cursor = $qb->execute();
- while($data = $cursor->fetch()) {
+ while ($data = $cursor->fetch()) {
$shares[] = $this->createShareObject($data);
}
$cursor->closeCursor();
@@ -881,7 +875,6 @@ class FederatedShareProvider implements IShareProvider {
* @throws ShareNotFound
*/
private function createShareObject($data) {
-
$share = new Share($this->rootFolder, $this->userManager);
$share->setId((int)$data['id'])
->setShareType((int)$data['share_type'])
@@ -1119,7 +1112,7 @@ class FederatedShareProvider implements IShareProvider {
);
$cursor = $qb->execute();
- while($data = $cursor->fetch()) {
+ while ($data = $cursor->fetch()) {
try {
$share = $this->createShareObject($data);
} catch (InvalidShare $e) {