Passed
Push — master ( 77a436...c4fddd )
by Lukas
17:57 queued 12s
created
apps/federatedfilesharing/lib/OCM/CloudFederationProviderFiles.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 		// for backward compatibility make sure that the remote url stored in the
195 195
 		// database ends with a trailing slash
196 196
 		if (substr($remote, -1) !== '/') {
197
-			$remote = $remote . '/';
197
+			$remote = $remote.'/';
198 198
 		}
199 199
 
200 200
 		$token = $share->getShareSecret();
@@ -221,23 +221,23 @@  discard block
 block discarded – undo
221 221
 
222 222
 			// FIXME this should be a method in the user management instead
223 223
 			if ($shareType === IShare::TYPE_USER) {
224
-				$this->logger->debug('shareWith before, ' . $shareWith, ['app' => 'files_sharing']);
224
+				$this->logger->debug('shareWith before, '.$shareWith, ['app' => 'files_sharing']);
225 225
 				Util::emitHook(
226 226
 					'\OCA\Files_Sharing\API\Server2Server',
227 227
 					'preLoginNameUsedAsUserName',
228 228
 					['uid' => &$shareWith]
229 229
 				);
230
-				$this->logger->debug('shareWith after, ' . $shareWith, ['app' => 'files_sharing']);
230
+				$this->logger->debug('shareWith after, '.$shareWith, ['app' => 'files_sharing']);
231 231
 
232 232
 				if (!$this->userManager->userExists($shareWith)) {
233
-					throw new ProviderCouldNotAddShareException('User does not exists', '',Http::STATUS_BAD_REQUEST);
233
+					throw new ProviderCouldNotAddShareException('User does not exists', '', Http::STATUS_BAD_REQUEST);
234 234
 				}
235 235
 
236 236
 				\OC_Util::setupFS($shareWith);
237 237
 			}
238 238
 
239 239
 			if ($shareType === IShare::TYPE_GROUP && !$this->groupManager->groupExists($shareWith)) {
240
-				throw new ProviderCouldNotAddShareException('Group does not exists', '',Http::STATUS_BAD_REQUEST);
240
+				throw new ProviderCouldNotAddShareException('Group does not exists', '', Http::STATUS_BAD_REQUEST);
241 241
 			}
242 242
 
243 243
 			$externalManager = new \OCA\Files_Sharing\External\Manager(
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 			);
257 257
 
258 258
 			try {
259
-				$externalManager->addShare($remote, $token, '', $name, $owner, $shareType,false, $shareWith, $remoteId);
259
+				$externalManager->addShare($remote, $token, '', $name, $owner, $shareType, false, $shareWith, $remoteId);
260 260
 				$shareId = \OC::$server->getDatabaseConnection()->lastInsertId('*PREFIX*share_external');
261 261
 
262 262
 				if ($shareType === IShare::TYPE_USER) {
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
 					'level' => ILogger::ERROR,
289 289
 					'app' => 'files_sharing'
290 290
 				]);
291
-				throw new ProviderCouldNotAddShareException('internal server error, was not able to add share from ' . $remote, '', HTTP::STATUS_INTERNAL_SERVER_ERROR);
291
+				throw new ProviderCouldNotAddShareException('internal server error, was not able to add share from '.$remote, '', HTTP::STATUS_INTERNAL_SERVER_ERROR);
292 292
 			}
293 293
 		}
294 294
 
@@ -354,12 +354,12 @@  discard block
 block discarded – undo
354 354
 
355 355
 		$declineAction = $notification->createAction();
356 356
 		$declineAction->setLabel('decline')
357
-			->setLink($this->urlGenerator->getAbsoluteURL($this->urlGenerator->linkTo('', 'ocs/v2.php/apps/files_sharing/api/v1/remote_shares/pending/' . $shareId)), 'DELETE');
357
+			->setLink($this->urlGenerator->getAbsoluteURL($this->urlGenerator->linkTo('', 'ocs/v2.php/apps/files_sharing/api/v1/remote_shares/pending/'.$shareId)), 'DELETE');
358 358
 		$notification->addAction($declineAction);
359 359
 
360 360
 		$acceptAction = $notification->createAction();
361 361
 		$acceptAction->setLabel('accept')
362
-			->setLink($this->urlGenerator->getAbsoluteURL($this->urlGenerator->linkTo('', 'ocs/v2.php/apps/files_sharing/api/v1/remote_shares/pending/' . $shareId)), 'POST');
362
+			->setLink($this->urlGenerator->getAbsoluteURL($this->urlGenerator->linkTo('', 'ocs/v2.php/apps/files_sharing/api/v1/remote_shares/pending/'.$shareId)), 'POST');
363 363
 		$notification->addAction($acceptAction);
364 364
 
365 365
 		$this->notificationManager->notify($notification);
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
 	 */
418 418
 	protected function executeAcceptShare(IShare $share) {
419 419
 		try {
420
-			$fileId = (int)$share->getNode()->getId();
420
+			$fileId = (int) $share->getNode()->getId();
421 421
 			[$file, $link] = $this->getFile($this->getCorrectUid($share), $fileId);
422 422
 		} catch (\Exception $e) {
423 423
 			throw new ShareNotFound();
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
 		$this->federatedShareProvider->removeShareFromTable($share);
494 494
 
495 495
 		try {
496
-			$fileId = (int)$share->getNode()->getId();
496
+			$fileId = (int) $share->getNode()->getId();
497 497
 			[$file, $link] = $this->getFile($this->getCorrectUid($share), $fileId);
498 498
 		} catch (\Exception $e) {
499 499
 			throw new ShareNotFound();
@@ -585,10 +585,10 @@  discard block
 block discarded – undo
585 585
 			// delete all child in case of a group share
586 586
 			$qb = $this->connection->getQueryBuilder();
587 587
 			$qb->delete('share_external')
588
-				->where($qb->expr()->eq('parent', $qb->createNamedParameter((int)$share['id'])));
588
+				->where($qb->expr()->eq('parent', $qb->createNamedParameter((int) $share['id'])));
589 589
 			$qb->execute();
590 590
 
591
-			if ((int)$share['share_type'] === IShare::TYPE_USER) {
591
+			if ((int) $share['share_type'] === IShare::TYPE_USER) {
592 592
 				if ($share['accepted']) {
593 593
 					$path = trim($mountpoint, '/');
594 594
 				} else {
@@ -597,7 +597,7 @@  discard block
 block discarded – undo
597 597
 				$notification = $this->notificationManager->createNotification();
598 598
 				$notification->setApp('files_sharing')
599 599
 					->setUser($share['user'])
600
-					->setObject('remote_share', (int)$share['id']);
600
+					->setObject('remote_share', (int) $share['id']);
601 601
 				$this->notificationManager->markProcessed($notification);
602 602
 
603 603
 				$event = $this->activityManager->generateEvent();
@@ -605,7 +605,7 @@  discard block
 block discarded – undo
605 605
 					->setType('remote_share')
606 606
 					->setSubject(RemoteShares::SUBJECT_REMOTE_SHARE_UNSHARED, [$owner->getId(), $path])
607 607
 					->setAffectedUser($user)
608
-					->setObject('remote_share', (int)$share['id'], $path);
608
+					->setObject('remote_share', (int) $share['id'], $path);
609 609
 				\OC::$server->getActivityManager()->publish($event);
610 610
 			}
611 611
 		}
@@ -649,7 +649,7 @@  discard block
 block discarded – undo
649 649
 		$share = $this->federatedShareProvider->getShareById($id);
650 650
 
651 651
 		// We have to respect the default share permissions
652
-		$permissions = $share->getPermissions() & (int)$this->config->getAppValue('core', 'shareapi_default_permissions', (string)Constants::PERMISSION_ALL);
652
+		$permissions = $share->getPermissions() & (int) $this->config->getAppValue('core', 'shareapi_default_permissions', (string) Constants::PERMISSION_ALL);
653 653
 		$share->setPermissions($permissions);
654 654
 
655 655
 		// don't allow to share a file back to the owner
@@ -658,7 +658,7 @@  discard block
 block discarded – undo
658 658
 			$owner = $share->getShareOwner();
659 659
 			$currentServer = $this->addressHandler->generateRemoteURL();
660 660
 			if ($this->addressHandler->compareAddresses($user, $remote, $owner, $currentServer)) {
661
-				throw new ProviderCouldNotAddShareException('Resharing back to the owner is not allowed: ' . $id);
661
+				throw new ProviderCouldNotAddShareException('Resharing back to the owner is not allowed: '.$id);
662 662
 			}
663 663
 		} catch (\Exception $e) {
664 664
 			throw new ProviderCouldNotAddShareException($e->getMessage());
@@ -672,10 +672,10 @@  discard block
 block discarded – undo
672 672
 			$share->setSharedBy($share->getSharedWith());
673 673
 			$share->setSharedWith($shareWith);
674 674
 			$result = $this->federatedShareProvider->create($share);
675
-			$this->federatedShareProvider->storeRemoteId((int)$result->getId(), $senderId);
675
+			$this->federatedShareProvider->storeRemoteId((int) $result->getId(), $senderId);
676 676
 			return ['token' => $result->getToken(), 'providerId' => $result->getId()];
677 677
 		} else {
678
-			throw new ProviderCouldNotAddShareException('resharing not allowed for share: ' . $id);
678
+			throw new ProviderCouldNotAddShareException('resharing not allowed for share: '.$id);
679 679
 		}
680 680
 	}
681 681
 
Please login to merge, or discard this patch.