Code Duplication    Length = 12-12 lines in 2 locations

lib/private/share/share.php 2 locations

@@ 706-717 (lines=12) @@
703
				}
704
			}
705
			// Check if the item source is already shared with the user, either from the same owner or a different user
706
			if ($checkExists = self::getItems($itemType, $itemSource, self::$shareTypeUserAndGroups,
707
				$shareWith, null, self::FORMAT_NONE, null, 1, true, true)) {
708
				// Only allow the same share to occur again if it is the same
709
				// owner and is not a user share, this use case is for increasing
710
				// permissions for a specific user
711
				if ($checkExists['uid_owner'] != $uidOwner || $checkExists['share_type'] == $shareType) {
712
					$message = 'Sharing %s failed, because this item is already shared with %s';
713
					$message_t = $l->t('Sharing %s failed, because this item is already shared with %s', array($itemSourceName, $shareWith));
714
					\OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName, $shareWith), \OCP\Util::DEBUG);
715
					throw new \Exception($message_t);
716
				}
717
			}
718
			if ($checkExists = self::getItems($itemType, $itemSource, self::SHARE_TYPE_USER,
719
				$shareWith, null, self::FORMAT_NONE, null, 1, true, true)) {
720
				// Only allow the same share to occur again if it is the same
@@ 718-729 (lines=12) @@
715
					throw new \Exception($message_t);
716
				}
717
			}
718
			if ($checkExists = self::getItems($itemType, $itemSource, self::SHARE_TYPE_USER,
719
				$shareWith, null, self::FORMAT_NONE, null, 1, true, true)) {
720
				// Only allow the same share to occur again if it is the same
721
				// owner and is not a user share, this use case is for increasing
722
				// permissions for a specific user
723
				if ($checkExists['uid_owner'] != $uidOwner || $checkExists['share_type'] == $shareType) {
724
					$message = 'Sharing %s failed, because this item is already shared with user %s';
725
					$message_t = $l->t('Sharing %s failed, because this item is already shared with user %s', array($itemSourceName, $shareWith));
726
					\OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName, $shareWith), \OCP\Util::ERROR);
727
					throw new \Exception($message_t);
728
				}
729
			}
730
		} else if ($shareType === self::SHARE_TYPE_GROUP) {
731
			if (!\OC_Group::groupExists($shareWith)) {
732
				$message = 'Sharing %s failed, because the group %s does not exist';