Completed
Pull Request — master (#6437)
by Lukas
12:06
created
lib/private/Share20/Manager.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
 
346 346
 		if ($fullId === null && $expirationDate === null && $this->shareApiLinkDefaultExpireDate()) {
347 347
 			$expirationDate = new \DateTime();
348
-			$expirationDate->setTime(0,0,0);
348
+			$expirationDate->setTime(0, 0, 0);
349 349
 			$expirationDate->add(new \DateInterval('P'.$this->shareApiLinkDefaultExpireDays().'D'));
350 350
 		}
351 351
 
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
 
358 358
 			$date = new \DateTime();
359 359
 			$date->setTime(0, 0, 0);
360
-			$date->add(new \DateInterval('P' . $this->shareApiLinkDefaultExpireDays() . 'D'));
360
+			$date->add(new \DateInterval('P'.$this->shareApiLinkDefaultExpireDays().'D'));
361 361
 			if ($date < $expirationDate) {
362 362
 				$message = $this->l->t('Can’t set expiration date more than %s days in the future', [$this->shareApiLinkDefaultExpireDays()]);
363 363
 				throw new GenericShareException($message, $message, 404);
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
 		 */
411 411
 		$provider = $this->factory->getProviderForType(\OCP\Share::SHARE_TYPE_USER);
412 412
 		$existingShares = $provider->getSharesByPath($share->getNode());
413
-		foreach($existingShares as $existingShare) {
413
+		foreach ($existingShares as $existingShare) {
414 414
 			// Ignore if it is the same share
415 415
 			try {
416 416
 				if ($existingShare->getFullId() === $share->getFullId()) {
@@ -467,7 +467,7 @@  discard block
 block discarded – undo
467 467
 		 */
468 468
 		$provider = $this->factory->getProviderForType(\OCP\Share::SHARE_TYPE_GROUP);
469 469
 		$existingShares = $provider->getSharesByPath($share->getNode());
470
-		foreach($existingShares as $existingShare) {
470
+		foreach ($existingShares as $existingShare) {
471 471
 			try {
472 472
 				if ($existingShare->getFullId() === $share->getFullId()) {
473 473
 					continue;
@@ -536,7 +536,7 @@  discard block
 block discarded – undo
536 536
 		// Make sure that we do not share a path that contains a shared mountpoint
537 537
 		if ($path instanceof \OCP\Files\Folder) {
538 538
 			$mounts = $this->mountManager->findIn($path->getPath());
539
-			foreach($mounts as $mount) {
539
+			foreach ($mounts as $mount) {
540 540
 				if ($mount->getStorage()->instanceOfStorage('\OCA\Files_Sharing\ISharedStorage')) {
541 541
 					throw new \InvalidArgumentException('Path contains files shared with you');
542 542
 				}
@@ -584,7 +584,7 @@  discard block
 block discarded – undo
584 584
 		$storage = $share->getNode()->getStorage();
585 585
 		if ($storage->instanceOfStorage('OCA\Files_Sharing\External\Storage')) {
586 586
 			$parent = $share->getNode()->getParent();
587
-			while($parent->getStorage()->instanceOfStorage('OCA\Files_Sharing\External\Storage')) {
587
+			while ($parent->getStorage()->instanceOfStorage('OCA\Files_Sharing\External\Storage')) {
588 588
 				$parent = $parent->getParent();
589 589
 			}
590 590
 			$share->setShareOwner($parent->getOwner()->getUID());
@@ -637,7 +637,7 @@  discard block
 block discarded – undo
637 637
 		}
638 638
 
639 639
 		// Generate the target
640
-		$target = $this->config->getSystemValue('share_folder', '/') .'/'. $share->getNode()->getName();
640
+		$target = $this->config->getSystemValue('share_folder', '/').'/'.$share->getNode()->getName();
641 641
 		$target = \OC\Files\Filesystem::normalizePath($target);
642 642
 		$share->setTarget($target);
643 643
 
@@ -660,7 +660,7 @@  discard block
 block discarded – undo
660 660
 
661 661
 		if ($share->getShareType() === \OCP\Share::SHARE_TYPE_USER) {
662 662
 			$mailSend = $share->getMailSend();
663
-			if($mailSend === true) {
663
+			if ($mailSend === true) {
664 664
 				$user = $this->userManager->get($share->getSharedWith());
665 665
 				if ($user !== null) {
666 666
 					$emailAddress = $user->getEMailAddress();
@@ -675,12 +675,12 @@  discard block
 block discarded – undo
675 675
 							$emailAddress,
676 676
 							$share->getExpirationDate()
677 677
 						);
678
-						$this->logger->debug('Send share notification to ' . $emailAddress . ' for share with ID ' . $share->getId(), ['app' => 'share']);
678
+						$this->logger->debug('Send share notification to '.$emailAddress.' for share with ID '.$share->getId(), ['app' => 'share']);
679 679
 					} else {
680
-						$this->logger->debug('Share notification not send to ' . $share->getSharedWith() . ' because email address is not set.', ['app' => 'share']);
680
+						$this->logger->debug('Share notification not send to '.$share->getSharedWith().' because email address is not set.', ['app' => 'share']);
681 681
 					}
682 682
 				} else {
683
-					$this->logger->debug('Share notification not send to ' . $share->getSharedWith() . ' because user could not be found.', ['app' => 'share']);
683
+					$this->logger->debug('Share notification not send to '.$share->getSharedWith().' because user could not be found.', ['app' => 'share']);
684 684
 				}
685 685
 			} else {
686 686
 				$this->logger->debug('Share notification not send because mailsend is false.', ['app' => 'share']);
@@ -724,7 +724,7 @@  discard block
 block discarded – undo
724 724
 		$text = $l->t('%s shared »%s« with you.', [$initiatorDisplayName, $filename]);
725 725
 
726 726
 		$emailTemplate->addBodyText(
727
-			$text . ' ' . $l->t('Click the button below to open it.'),
727
+			$text.' '.$l->t('Click the button below to open it.'),
728 728
 			$text
729 729
 		);
730 730
 		$emailTemplate->addBodyButton(
@@ -748,9 +748,9 @@  discard block
 block discarded – undo
748 748
 		// The "Reply-To" is set to the sharer if an mail address is configured
749 749
 		// also the default footer contains a "Do not reply" which needs to be adjusted.
750 750
 		$initiatorEmail = $initiatorUser->getEMailAddress();
751
-		if($initiatorEmail !== null) {
751
+		if ($initiatorEmail !== null) {
752 752
 			$message->setReplyTo([$initiatorEmail => $initiatorDisplayName]);
753
-			$emailTemplate->addFooter($instanceName . ' - ' . $this->defaults->getSlogan());
753
+			$emailTemplate->addFooter($instanceName.' - '.$this->defaults->getSlogan());
754 754
 		} else {
755 755
 			$emailTemplate->addFooter();
756 756
 		}
@@ -961,7 +961,7 @@  discard block
 block discarded – undo
961 961
 	 * @param string $recipientId
962 962
 	 */
963 963
 	public function deleteFromSelf(\OCP\Share\IShare $share, $recipientId) {
964
-		list($providerId, ) = $this->splitFullId($share->getFullId());
964
+		list($providerId,) = $this->splitFullId($share->getFullId());
965 965
 		$provider = $this->factory->getProvider($providerId);
966 966
 
967 967
 		$provider->deleteFromSelf($share, $recipientId);
@@ -984,7 +984,7 @@  discard block
 block discarded – undo
984 984
 		if ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) {
985 985
 			$sharedWith = $this->groupManager->get($share->getSharedWith());
986 986
 			if (is_null($sharedWith)) {
987
-				throw new \InvalidArgumentException('Group "' . $share->getSharedWith() . '" does not exist');
987
+				throw new \InvalidArgumentException('Group "'.$share->getSharedWith().'" does not exist');
988 988
 			}
989 989
 			$recipient = $this->userManager->get($recipientId);
990 990
 			if (!$sharedWith->inGroup($recipient)) {
@@ -992,7 +992,7 @@  discard block
 block discarded – undo
992 992
 			}
993 993
 		}
994 994
 
995
-		list($providerId, ) = $this->splitFullId($share->getFullId());
995
+		list($providerId,) = $this->splitFullId($share->getFullId());
996 996
 		$provider = $this->factory->getProvider($providerId);
997 997
 
998 998
 		$provider->move($share, $recipientId);
@@ -1039,7 +1039,7 @@  discard block
 block discarded – undo
1039 1039
 
1040 1040
 		$shares2 = [];
1041 1041
 
1042
-		while(true) {
1042
+		while (true) {
1043 1043
 			$added = 0;
1044 1044
 			foreach ($shares as $share) {
1045 1045
 
@@ -1139,7 +1139,7 @@  discard block
 block discarded – undo
1139 1139
 	 *
1140 1140
 	 * @return Share[]
1141 1141
 	 */
1142
-	public function getSharesByPath(\OCP\Files\Node $path, $page=0, $perPage=50) {
1142
+	public function getSharesByPath(\OCP\Files\Node $path, $page = 0, $perPage = 50) {
1143 1143
 		return [];
1144 1144
 	}
1145 1145
 
@@ -1154,7 +1154,7 @@  discard block
 block discarded – undo
1154 1154
 	public function getShareByToken($token) {
1155 1155
 		$share = null;
1156 1156
 		try {
1157
-			if($this->shareApiAllowLinks()) {
1157
+			if ($this->shareApiAllowLinks()) {
1158 1158
 				$provider = $this->factory->getProviderForType(\OCP\Share::SHARE_TYPE_LINK);
1159 1159
 				$share = $provider->getShareByToken($token);
1160 1160
 			}
@@ -1361,7 +1361,7 @@  discard block
 block discarded – undo
1361 1361
 			}
1362 1362
 			$al['users'][$owner] = [
1363 1363
 				'node_id' => $path->getId(),
1364
-				'node_path' => '/' . $ownerPath,
1364
+				'node_path' => '/'.$ownerPath,
1365 1365
 			];
1366 1366
 		} else {
1367 1367
 			$al['users'][] = $owner;
@@ -1455,7 +1455,7 @@  discard block
 block discarded – undo
1455 1455
 	 * @return int
1456 1456
 	 */
1457 1457
 	public function shareApiLinkDefaultExpireDays() {
1458
-		return (int)$this->config->getAppValue('core', 'shareapi_expire_after_n_days', '7');
1458
+		return (int) $this->config->getAppValue('core', 'shareapi_expire_after_n_days', '7');
1459 1459
 	}
1460 1460
 
1461 1461
 	/**
Please login to merge, or discard this patch.