Completed
Push — master ( 835746...319216 )
by John
32:58 queued 15s
created
apps/files_sharing/lib/Controller/ShareAPIController.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 					'message' => $userStatus->getMessage(),
219 219
 					'icon' => $userStatus->getIcon(),
220 220
 					'clearAt' => $userStatus->getClearAt()
221
-						? (int)$userStatus->getClearAt()->format('U')
221
+						? (int) $userStatus->getClearAt()->format('U')
222 222
 						: null,
223 223
 				];
224 224
 			}
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 			// "share_with" and "share_with_displayname" for passwords of link
232 232
 			// shares was deprecated in Nextcloud 15, use "password" instead.
233 233
 			$result['share_with'] = $share->getPassword();
234
-			$result['share_with_displayname'] = '(' . $this->l->t('Shared link') . ')';
234
+			$result['share_with_displayname'] = '('.$this->l->t('Shared link').')';
235 235
 
236 236
 			$result['password'] = $share->getPassword();
237 237
 
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
 
313 313
 		$result['attributes'] = null;
314 314
 		if ($attributes = $share->getAttributes()) {
315
-			$result['attributes'] = (string)\json_encode($attributes->toArray());
315
+			$result['attributes'] = (string) \json_encode($attributes->toArray());
316 316
 		}
317 317
 
318 318
 		return $result;
@@ -614,7 +614,7 @@  discard block
 block discarded – undo
614 614
 		} else {
615 615
 			// Use default permissions only for non-link shares to keep legacy behavior
616 616
 			if ($permissions === null) {
617
-				$permissions = (int)$this->config->getAppValue('core', 'shareapi_default_permissions', (string)Constants::PERMISSION_ALL);
617
+				$permissions = (int) $this->config->getAppValue('core', 'shareapi_default_permissions', (string) Constants::PERMISSION_ALL);
618 618
 			}
619 619
 			// Non-link shares always require read permissions (link shares could be file drop)
620 620
 			$permissions |= Constants::PERMISSION_READ;
@@ -801,7 +801,7 @@  discard block
 block discarded – undo
801 801
 		} catch (HintException $e) {
802 802
 			$code = $e->getCode() === 0 ? 403 : $e->getCode();
803 803
 			throw new OCSException($e->getHint(), $code);
804
-		} catch (GenericShareException|\InvalidArgumentException $e) {
804
+		} catch (GenericShareException | \InvalidArgumentException $e) {
805 805
 			$this->logger->error($e->getMessage(), ['exception' => $e]);
806 806
 			throw new OCSForbiddenException($e->getMessage(), $e);
807 807
 		} catch (\Exception $e) {
@@ -830,7 +830,7 @@  discard block
 block discarded – undo
830 830
 
831 831
 		$shares = array_merge($userShares, $groupShares, $circleShares, $roomShares, $deckShares, $sciencemeshShares);
832 832
 
833
-		$filteredShares = array_filter($shares, function (IShare $share) {
833
+		$filteredShares = array_filter($shares, function(IShare $share) {
834 834
 			return $share->getShareOwner() !== $this->userId;
835 835
 		});
836 836
 
@@ -867,7 +867,7 @@  discard block
 block discarded – undo
867 867
 		$nodes = $folder->getDirectoryListing();
868 868
 
869 869
 		/** @var IShare[] $shares */
870
-		$shares = array_reduce($nodes, function ($carry, $node) {
870
+		$shares = array_reduce($nodes, function($carry, $node) {
871 871
 			$carry = array_merge($carry, $this->getAllShares($node, true));
872 872
 			return $carry;
873 873
 		}, []);
@@ -1087,7 +1087,7 @@  discard block
 block discarded – undo
1087 1087
 				if (!$resharingRight && $this->shareProviderResharingRights($this->userId, $share, $node)) {
1088 1088
 					$resharingRight = true;
1089 1089
 				}
1090
-			} catch (InvalidPathException|NotFoundException $e) {
1090
+			} catch (InvalidPathException | NotFoundException $e) {
1091 1091
 			}
1092 1092
 		}
1093 1093
 
@@ -1369,7 +1369,7 @@  discard block
 block discarded – undo
1369 1369
 			$share = $this->shareManager->updateShare($share);
1370 1370
 		} catch (HintException $e) {
1371 1371
 			$code = $e->getCode() === 0 ? 403 : $e->getCode();
1372
-			throw new OCSException($e->getHint(), (int)$code);
1372
+			throw new OCSException($e->getHint(), (int) $code);
1373 1373
 		} catch (\Exception $e) {
1374 1374
 			$this->logger->error($e->getMessage(), ['exception' => $e]);
1375 1375
 			throw new OCSBadRequestException('Failed to update share.', $e);
@@ -1414,7 +1414,7 @@  discard block
 block discarded – undo
1414 1414
 			}
1415 1415
 		}
1416 1416
 
1417
-		$result = array_values(array_filter(array_map(function (IShare $share) {
1417
+		$result = array_values(array_filter(array_map(function(IShare $share) {
1418 1418
 			$userFolder = $this->rootFolder->getUserFolder($share->getSharedBy());
1419 1419
 			$node = $userFolder->getFirstNodeById($share->getNodeId());
1420 1420
 			if (!$node) {
@@ -1427,13 +1427,13 @@  discard block
 block discarded – undo
1427 1427
 
1428 1428
 			try {
1429 1429
 				$formattedShare = $this->formatShare($share, $node);
1430
-				$formattedShare['path'] = '/' . $share->getNode()->getName();
1430
+				$formattedShare['path'] = '/'.$share->getNode()->getName();
1431 1431
 				$formattedShare['permissions'] = 0;
1432 1432
 				return $formattedShare;
1433 1433
 			} catch (NotFoundException $e) {
1434 1434
 				return null;
1435 1435
 			}
1436
-		}, $pendingShares), function ($entry) {
1436
+		}, $pendingShares), function($entry) {
1437 1437
 			return $entry !== null;
1438 1438
 		}));
1439 1439
 
@@ -1467,7 +1467,7 @@  discard block
 block discarded – undo
1467 1467
 			$this->shareManager->acceptShare($share, $this->userId);
1468 1468
 		} catch (HintException $e) {
1469 1469
 			$code = $e->getCode() === 0 ? 403 : $e->getCode();
1470
-			throw new OCSException($e->getHint(), (int)$code);
1470
+			throw new OCSException($e->getHint(), (int) $code);
1471 1471
 		} catch (\Exception $e) {
1472 1472
 			$this->logger->error($e->getMessage(), ['exception' => $e]);
1473 1473
 			throw new OCSBadRequestException('Failed to accept share.', $e);
@@ -1722,7 +1722,7 @@  discard block
 block discarded – undo
1722 1722
 
1723 1723
 		// First check if it is an internal share.
1724 1724
 		try {
1725
-			$share = $this->shareManager->getShareById('ocinternal:' . $id, $this->userId);
1725
+			$share = $this->shareManager->getShareById('ocinternal:'.$id, $this->userId);
1726 1726
 			return $share;
1727 1727
 		} catch (ShareNotFound $e) {
1728 1728
 			// Do nothing, just try the other share type
@@ -1731,7 +1731,7 @@  discard block
 block discarded – undo
1731 1731
 
1732 1732
 		try {
1733 1733
 			if ($this->shareManager->shareProviderExists(IShare::TYPE_CIRCLE)) {
1734
-				$share = $this->shareManager->getShareById('ocCircleShare:' . $id, $this->userId);
1734
+				$share = $this->shareManager->getShareById('ocCircleShare:'.$id, $this->userId);
1735 1735
 				return $share;
1736 1736
 			}
1737 1737
 		} catch (ShareNotFound $e) {
@@ -1740,7 +1740,7 @@  discard block
 block discarded – undo
1740 1740
 
1741 1741
 		try {
1742 1742
 			if ($this->shareManager->shareProviderExists(IShare::TYPE_EMAIL)) {
1743
-				$share = $this->shareManager->getShareById('ocMailShare:' . $id, $this->userId);
1743
+				$share = $this->shareManager->getShareById('ocMailShare:'.$id, $this->userId);
1744 1744
 				return $share;
1745 1745
 			}
1746 1746
 		} catch (ShareNotFound $e) {
@@ -1748,7 +1748,7 @@  discard block
 block discarded – undo
1748 1748
 		}
1749 1749
 
1750 1750
 		try {
1751
-			$share = $this->shareManager->getShareById('ocRoomShare:' . $id, $this->userId);
1751
+			$share = $this->shareManager->getShareById('ocRoomShare:'.$id, $this->userId);
1752 1752
 			return $share;
1753 1753
 		} catch (ShareNotFound $e) {
1754 1754
 			// Do nothing, just try the other share type
@@ -1756,7 +1756,7 @@  discard block
 block discarded – undo
1756 1756
 
1757 1757
 		try {
1758 1758
 			if ($this->shareManager->shareProviderExists(IShare::TYPE_DECK)) {
1759
-				$share = $this->shareManager->getShareById('deck:' . $id, $this->userId);
1759
+				$share = $this->shareManager->getShareById('deck:'.$id, $this->userId);
1760 1760
 				return $share;
1761 1761
 			}
1762 1762
 		} catch (ShareNotFound $e) {
@@ -1765,7 +1765,7 @@  discard block
 block discarded – undo
1765 1765
 
1766 1766
 		try {
1767 1767
 			if ($this->shareManager->shareProviderExists(IShare::TYPE_SCIENCEMESH)) {
1768
-				$share = $this->shareManager->getShareById('sciencemesh:' . $id, $this->userId);
1768
+				$share = $this->shareManager->getShareById('sciencemesh:'.$id, $this->userId);
1769 1769
 				return $share;
1770 1770
 			}
1771 1771
 		} catch (ShareNotFound $e) {
@@ -1775,7 +1775,7 @@  discard block
 block discarded – undo
1775 1775
 		if (!$this->shareManager->outgoingServer2ServerSharesAllowed()) {
1776 1776
 			throw new ShareNotFound();
1777 1777
 		}
1778
-		$share = $this->shareManager->getShareById('ocFederatedSharing:' . $id, $this->userId);
1778
+		$share = $this->shareManager->getShareById('ocFederatedSharing:'.$id, $this->userId);
1779 1779
 
1780 1780
 		return $share;
1781 1781
 	}
@@ -1931,7 +1931,7 @@  discard block
 block discarded – undo
1931 1931
 					if ($this->shareProviderResharingRights($viewer, $share, $node)) {
1932 1932
 						return true;
1933 1933
 					}
1934
-				} catch (InvalidPathException|NotFoundException $e) {
1934
+				} catch (InvalidPathException | NotFoundException $e) {
1935 1935
 				}
1936 1936
 			}
1937 1937
 		}
Please login to merge, or discard this patch.