Code Duplication    Length = 6-6 lines in 2 locations

apps/federatedfilesharing/lib/FederatedShareProvider.php 1 location

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

apps/sharebymail/lib/ShareByMailProvider.php 1 location

@@ 166-171 (lines=6) @@
163
		 * Check if file is not already shared with the remote user
164
		 */
165
		$alreadyShared = $this->getSharedWith($shareWith, \OCP\Share::SHARE_TYPE_EMAIL, $share->getNode(), 1, 0);
166
		if (!empty($alreadyShared)) {
167
			$message = 'Sharing %s failed, this item is already shared with %s';
168
			$message_t = $this->l->t('Sharing %s failed, this item is already shared with %s', array($share->getNode()->getName(), $shareWith));
169
			$this->logger->debug(sprintf($message, $share->getNode()->getName(), $shareWith), ['app' => 'Federated File Sharing']);
170
			throw new \Exception($message_t);
171
		}
172
173
		// if the admin enforces a password for all mail shares we create a
174
		// random password and send it to the recipient