Code Duplication    Length = 6-6 lines in 2 locations

apps/federatedfilesharing/lib/FederatedShareProvider.php 1 location

@@ 155-160 (lines=6) @@
152
		 * Check if file is not already shared with the remote user
153
		 */
154
		$alreadyShared = $this->getSharedWith($shareWith, self::SHARE_TYPE_REMOTE, $share->getNode(), 1, 0);
155
		if (!empty($alreadyShared)) {
156
			$message = 'Sharing %s failed, because this item is already shared with %s';
157
			$message_t = $this->l->t('Sharing %s failed, because this item is already shared with %s', array($share->getNode()->getName(), $shareWith));
158
			$this->logger->debug(sprintf($message, $share->getNode()->getName(), $shareWith), ['app' => 'Federated File Sharing']);
159
			throw new \Exception($message_t);
160
		}
161
162
163
		// don't allow federated shares if source and target server are the same

apps/sharebymail/lib/ShareByMailProvider.php 1 location

@@ 145-150 (lines=6) @@
142
		 * Check if file is not already shared with the remote user
143
		 */
144
		$alreadyShared = $this->getSharedWith($shareWith, \OCP\Share::SHARE_TYPE_EMAIL, $share->getNode(), 1, 0);
145
		if (!empty($alreadyShared)) {
146
			$message = 'Sharing %s failed, this item is already shared with %s';
147
			$message_t = $this->l->t('Sharing %s failed, this item is already shared with %s', array($share->getNode()->getName(), $shareWith));
148
			$this->logger->debug(sprintf($message, $share->getNode()->getName(), $shareWith), ['app' => 'Federated File Sharing']);
149
			throw new \Exception($message_t);
150
		}
151
152
		$shareId = $this->createMailShare($share);
153
		$this->createActivity($share);