Code Duplication    Length = 3-5 lines in 5 locations

apps/files_sharing/lib/Controller/ShareAPIController.php 5 locations

@@ 619-621 (lines=3) @@
616
			if($this->shareManager->shareProviderExists(Share::SHARE_TYPE_EMAIL)) {
617
				$shares = array_merge($shares, $this->shareManager->getSharesBy($this->currentUser, Share::SHARE_TYPE_EMAIL, $node, false, -1, 0));
618
			}
619
			if ($this->shareManager->outgoingServer2ServerSharesAllowed()) {
620
				$shares = array_merge($shares, $this->shareManager->getSharesBy($this->currentUser, Share::SHARE_TYPE_REMOTE, $node, false, -1, 0));
621
			}
622
			$shares = array_merge($shares, $this->shareManager->getSharesBy($this->currentUser, Share::SHARE_TYPE_ROOM, $node, false, -1, 0));
623
		}
624
@@ 698-702 (lines=5) @@
695
		$userShares = $this->shareManager->getSharesBy($this->currentUser, Share::SHARE_TYPE_USER, $path, $reshares, -1, 0);
696
		$groupShares = $this->shareManager->getSharesBy($this->currentUser, Share::SHARE_TYPE_GROUP, $path, $reshares, -1, 0);
697
		$linkShares = $this->shareManager->getSharesBy($this->currentUser, Share::SHARE_TYPE_LINK, $path, $reshares, -1, 0);
698
		if ($this->shareManager->shareProviderExists(Share::SHARE_TYPE_EMAIL)) {
699
			$mailShares = $this->shareManager->getSharesBy($this->currentUser, Share::SHARE_TYPE_EMAIL, $path, $reshares, -1, 0);
700
		} else {
701
			$mailShares = [];
702
		}
703
		if ($this->shareManager->shareProviderExists(Share::SHARE_TYPE_CIRCLE)) {
704
			$circleShares = $this->shareManager->getSharesBy($this->currentUser, Share::SHARE_TYPE_CIRCLE, $path, $reshares, -1, 0);
705
		} else {
@@ 703-707 (lines=5) @@
700
		} else {
701
			$mailShares = [];
702
		}
703
		if ($this->shareManager->shareProviderExists(Share::SHARE_TYPE_CIRCLE)) {
704
			$circleShares = $this->shareManager->getSharesBy($this->currentUser, Share::SHARE_TYPE_CIRCLE, $path, $reshares, -1, 0);
705
		} else {
706
			$circleShares = [];
707
		}
708
		$roomShares = $this->shareManager->getSharesBy($this->currentUser, Share::SHARE_TYPE_ROOM, $path, $reshares, -1, 0);
709
710
		$shares = array_merge($userShares, $groupShares, $linkShares, $mailShares, $circleShares, $roomShares);
@@ 712-715 (lines=4) @@
709
710
		$shares = array_merge($userShares, $groupShares, $linkShares, $mailShares, $circleShares, $roomShares);
711
712
		if ($this->shareManager->outgoingServer2ServerSharesAllowed()) {
713
			$federatedShares = $this->shareManager->getSharesBy($this->currentUser, Share::SHARE_TYPE_REMOTE, $path, $reshares, -1, 0);
714
			$shares = array_merge($shares, $federatedShares);
715
		}
716
717
		if ($this->shareManager->outgoingServer2ServerGroupSharesAllowed()) {
718
			$federatedShares = $this->shareManager->getSharesBy($this->currentUser, Share::SHARE_TYPE_REMOTE_GROUP, $path, $reshares, -1, 0);
@@ 717-720 (lines=4) @@
714
			$shares = array_merge($shares, $federatedShares);
715
		}
716
717
		if ($this->shareManager->outgoingServer2ServerGroupSharesAllowed()) {
718
			$federatedShares = $this->shareManager->getSharesBy($this->currentUser, Share::SHARE_TYPE_REMOTE_GROUP, $path, $reshares, -1, 0);
719
			$shares = array_merge($shares, $federatedShares);
720
		}
721
722
		$formatted = [];
723
		foreach ($shares as $share) {