Passed
Push — master ( d0f738...426dc6 )
by Roeland
12:00 queued 10s
created
lib/private/Share20/Manager.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -300,14 +300,14 @@  discard block
 block discarded – undo
300 300
 		$permissions = 0;
301 301
 
302 302
 		if (!$isFederatedShare && $share->getNode()->getOwner() && $share->getNode()->getOwner()->getUID() !== $share->getSharedBy()) {
303
-			$userMounts = array_filter($userFolder->getById($share->getNode()->getId()), function ($mount) {
303
+			$userMounts = array_filter($userFolder->getById($share->getNode()->getId()), function($mount) {
304 304
 				// We need to filter since there might be other mountpoints that contain the file
305 305
 				// e.g. if the user has access to the same external storage that the file is originating from
306 306
 				return $mount->getStorage()->instanceOfStorage(ISharedStorage::class);
307 307
 			});
308 308
 			$userMount = array_shift($userMounts);
309 309
 			if ($userMount === null) {
310
-				throw new GenericShareException('Could not get proper share mount for ' . $share->getNode()->getId() . '. Failing since else the next calls are called with null');
310
+				throw new GenericShareException('Could not get proper share mount for '.$share->getNode()->getId().'. Failing since else the next calls are called with null');
311 311
 			}
312 312
 			$mount = $userMount->getMountPoint();
313 313
 			// When it's a reshare use the parent share permissions as maximum
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
 			$userMountPoint = array_shift($userMountPoints);
317 317
 
318 318
 			if ($userMountPoint === null) {
319
-				throw new GenericShareException('Could not get proper user mount for ' . $userMountPointId . '. Failing since else the next calls are called with null');
319
+				throw new GenericShareException('Could not get proper user mount for '.$userMountPointId.'. Failing since else the next calls are called with null');
320 320
 			}
321 321
 
322 322
 			/* Check if this is an incoming share */
@@ -406,9 +406,9 @@  discard block
 block discarded – undo
406 406
 
407 407
 		if ($fullId === null && $expirationDate === null && $this->shareApiInternalDefaultExpireDate()) {
408 408
 			$expirationDate = new \DateTime();
409
-			$expirationDate->setTime(0,0,0);
409
+			$expirationDate->setTime(0, 0, 0);
410 410
 
411
-			$days = (int)$this->config->getAppValue('core', 'internal_defaultExpDays', (string)$this->shareApiInternalDefaultExpireDays());
411
+			$days = (int) $this->config->getAppValue('core', 'internal_defaultExpDays', (string) $this->shareApiInternalDefaultExpireDays());
412 412
 			if ($days > $this->shareApiInternalDefaultExpireDays()) {
413 413
 				$days = $this->shareApiInternalDefaultExpireDays();
414 414
 			}
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
 
424 424
 			$date = new \DateTime();
425 425
 			$date->setTime(0, 0, 0);
426
-			$date->add(new \DateInterval('P' . $this->shareApiInternalDefaultExpireDays() . 'D'));
426
+			$date->add(new \DateInterval('P'.$this->shareApiInternalDefaultExpireDays().'D'));
427 427
 			if ($date < $expirationDate) {
428 428
 				$message = $this->l->t('Can’t set expiration date more than %s days in the future', [$this->shareApiInternalDefaultExpireDays()]);
429 429
 				throw new GenericShareException($message, $message, 404);
@@ -482,9 +482,9 @@  discard block
 block discarded – undo
482 482
 
483 483
 		if ($fullId === null && $expirationDate === null && $this->shareApiLinkDefaultExpireDate()) {
484 484
 			$expirationDate = new \DateTime();
485
-			$expirationDate->setTime(0,0,0);
485
+			$expirationDate->setTime(0, 0, 0);
486 486
 
487
-			$days = (int)$this->config->getAppValue('core', 'link_defaultExpDays', $this->shareApiLinkDefaultExpireDays());
487
+			$days = (int) $this->config->getAppValue('core', 'link_defaultExpDays', $this->shareApiLinkDefaultExpireDays());
488 488
 			if ($days > $this->shareApiLinkDefaultExpireDays()) {
489 489
 				$days = $this->shareApiLinkDefaultExpireDays();
490 490
 			}
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
 
500 500
 			$date = new \DateTime();
501 501
 			$date->setTime(0, 0, 0);
502
-			$date->add(new \DateInterval('P' . $this->shareApiLinkDefaultExpireDays() . 'D'));
502
+			$date->add(new \DateInterval('P'.$this->shareApiLinkDefaultExpireDays().'D'));
503 503
 			if ($date < $expirationDate) {
504 504
 				$message = $this->l->t('Can’t set expiration date more than %s days in the future', [$this->shareApiLinkDefaultExpireDays()]);
505 505
 				throw new GenericShareException($message, $message, 404);
@@ -784,7 +784,7 @@  discard block
 block discarded – undo
784 784
 		}
785 785
 
786 786
 		// Generate the target
787
-		$target = $this->config->getSystemValue('share_folder', '/') .'/'. $share->getNode()->getName();
787
+		$target = $this->config->getSystemValue('share_folder', '/').'/'.$share->getNode()->getName();
788 788
 		$target = \OC\Files\Filesystem::normalizePath($target);
789 789
 		$share->setTarget($target);
790 790
 
@@ -830,12 +830,12 @@  discard block
 block discarded – undo
830 830
 							$emailAddress,
831 831
 							$share->getExpirationDate()
832 832
 						);
833
-						$this->logger->debug('Sent share notification to ' . $emailAddress . ' for share with ID ' . $share->getId(), ['app' => 'share']);
833
+						$this->logger->debug('Sent share notification to '.$emailAddress.' for share with ID '.$share->getId(), ['app' => 'share']);
834 834
 					} else {
835
-						$this->logger->debug('Share notification not sent to ' . $share->getSharedWith() . ' because email address is not set.', ['app' => 'share']);
835
+						$this->logger->debug('Share notification not sent to '.$share->getSharedWith().' because email address is not set.', ['app' => 'share']);
836 836
 					}
837 837
 				} else {
838
-					$this->logger->debug('Share notification not sent to ' . $share->getSharedWith() . ' because user could not be found.', ['app' => 'share']);
838
+					$this->logger->debug('Share notification not sent to '.$share->getSharedWith().' because user could not be found.', ['app' => 'share']);
839 839
 				}
840 840
 			} else {
841 841
 				$this->logger->debug('Share notification not sent because mailsend is false.', ['app' => 'share']);
@@ -882,7 +882,7 @@  discard block
 block discarded – undo
882 882
 		$text = $l->t('%1$s shared »%2$s« with you.', [$initiatorDisplayName, $filename]);
883 883
 
884 884
 		$emailTemplate->addBodyText(
885
-			htmlspecialchars($text . ' ' . $l->t('Click the button below to open it.')),
885
+			htmlspecialchars($text.' '.$l->t('Click the button below to open it.')),
886 886
 			$text
887 887
 		);
888 888
 		$emailTemplate->addBodyButton(
@@ -908,7 +908,7 @@  discard block
 block discarded – undo
908 908
 		$initiatorEmail = $initiatorUser->getEMailAddress();
909 909
 		if ($initiatorEmail !== null) {
910 910
 			$message->setReplyTo([$initiatorEmail => $initiatorDisplayName]);
911
-			$emailTemplate->addFooter($instanceName . ($this->defaults->getSlogan($l->getLanguageCode()) !== '' ? ' - ' . $this->defaults->getSlogan($l->getLanguageCode()) : ''));
911
+			$emailTemplate->addFooter($instanceName.($this->defaults->getSlogan($l->getLanguageCode()) !== '' ? ' - '.$this->defaults->getSlogan($l->getLanguageCode()) : ''));
912 912
 		} else {
913 913
 			$emailTemplate->addFooter('', $l->getLanguageCode());
914 914
 		}
@@ -917,7 +917,7 @@  discard block
 block discarded – undo
917 917
 		try {
918 918
 			$failedRecipients = $this->mailer->send($message);
919 919
 			if (!empty($failedRecipients)) {
920
-				$this->logger->error('Share notification mail could not be sent to: ' . implode(', ', $failedRecipients));
920
+				$this->logger->error('Share notification mail could not be sent to: '.implode(', ', $failedRecipients));
921 921
 				return;
922 922
 			}
923 923
 		} catch (\Exception $e) {
@@ -1186,7 +1186,7 @@  discard block
 block discarded – undo
1186 1186
 	 * @param string $recipientId
1187 1187
 	 */
1188 1188
 	public function deleteFromSelf(IShare $share, $recipientId) {
1189
-		list($providerId, ) = $this->splitFullId($share->getFullId());
1189
+		list($providerId,) = $this->splitFullId($share->getFullId());
1190 1190
 		$provider = $this->factory->getProvider($providerId);
1191 1191
 
1192 1192
 		$provider->deleteFromSelf($share, $recipientId);
@@ -1195,7 +1195,7 @@  discard block
 block discarded – undo
1195 1195
 	}
1196 1196
 
1197 1197
 	public function restoreShare(IShare $share, string $recipientId): IShare {
1198
-		list($providerId, ) = $this->splitFullId($share->getFullId());
1198
+		list($providerId,) = $this->splitFullId($share->getFullId());
1199 1199
 		$provider = $this->factory->getProvider($providerId);
1200 1200
 
1201 1201
 		return $provider->restore($share, $recipientId);
@@ -1216,7 +1216,7 @@  discard block
 block discarded – undo
1216 1216
 		if ($share->getShareType() === IShare::TYPE_GROUP) {
1217 1217
 			$sharedWith = $this->groupManager->get($share->getSharedWith());
1218 1218
 			if (is_null($sharedWith)) {
1219
-				throw new \InvalidArgumentException('Group "' . $share->getSharedWith() . '" does not exist');
1219
+				throw new \InvalidArgumentException('Group "'.$share->getSharedWith().'" does not exist');
1220 1220
 			}
1221 1221
 			$recipient = $this->userManager->get($recipientId);
1222 1222
 			if (!$sharedWith->inGroup($recipient)) {
@@ -1224,7 +1224,7 @@  discard block
 block discarded – undo
1224 1224
 			}
1225 1225
 		}
1226 1226
 
1227
-		list($providerId, ) = $this->splitFullId($share->getFullId());
1227
+		list($providerId,) = $this->splitFullId($share->getFullId());
1228 1228
 		$provider = $this->factory->getProvider($providerId);
1229 1229
 
1230 1230
 		return $provider->move($share, $recipientId);
@@ -1233,7 +1233,7 @@  discard block
 block discarded – undo
1233 1233
 	public function getSharesInFolder($userId, Folder $node, $reshares = false) {
1234 1234
 		$providers = $this->factory->getAllProviders();
1235 1235
 
1236
-		return array_reduce($providers, function ($shares, IShareProvider $provider) use ($userId, $node, $reshares) {
1236
+		return array_reduce($providers, function($shares, IShareProvider $provider) use ($userId, $node, $reshares) {
1237 1237
 			$newShares = $provider->getSharesInFolder($userId, $node, $reshares);
1238 1238
 			foreach ($newShares as $fid => $data) {
1239 1239
 				if (!isset($shares[$fid])) {
@@ -1350,12 +1350,12 @@  discard block
 block discarded – undo
1350 1350
 		$shares = $this->getSharedWith($userId, $shareType, $node, $limit, $offset);
1351 1351
 
1352 1352
 		// Only get deleted shares
1353
-		$shares = array_filter($shares, function (IShare $share) {
1353
+		$shares = array_filter($shares, function(IShare $share) {
1354 1354
 			return $share->getPermissions() === 0;
1355 1355
 		});
1356 1356
 
1357 1357
 		// Only get shares where the owner still exists
1358
-		$shares = array_filter($shares, function (IShare $share) {
1358
+		$shares = array_filter($shares, function(IShare $share) {
1359 1359
 			return $this->userManager->userExists($share->getShareOwner());
1360 1360
 		});
1361 1361
 
@@ -1652,7 +1652,7 @@  discard block
 block discarded – undo
1652 1652
 			}
1653 1653
 			$al['users'][$owner] = [
1654 1654
 				'node_id' => $path->getId(),
1655
-				'node_path' => '/' . $ownerPath,
1655
+				'node_path' => '/'.$ownerPath,
1656 1656
 			];
1657 1657
 		} else {
1658 1658
 			$al['users'][] = $owner;
@@ -1753,7 +1753,7 @@  discard block
 block discarded – undo
1753 1753
 	 * @return int
1754 1754
 	 */
1755 1755
 	public function shareApiLinkDefaultExpireDays() {
1756
-		return (int)$this->config->getAppValue('core', 'shareapi_expire_after_n_days', '7');
1756
+		return (int) $this->config->getAppValue('core', 'shareapi_expire_after_n_days', '7');
1757 1757
 	}
1758 1758
 
1759 1759
 	/**
@@ -1781,7 +1781,7 @@  discard block
 block discarded – undo
1781 1781
 	 * @return int
1782 1782
 	 */
1783 1783
 	public function shareApiInternalDefaultExpireDays(): int {
1784
-		return (int)$this->config->getAppValue('core', 'shareapi_internal_expire_after_n_days', '7');
1784
+		return (int) $this->config->getAppValue('core', 'shareapi_internal_expire_after_n_days', '7');
1785 1785
 	}
1786 1786
 
1787 1787
 	/**
Please login to merge, or discard this patch.