Code Duplication    Length = 12-12 lines in 2 locations

lib/private/Share/Share.php 2 locations

@@ 443-454 (lines=12) @@
440
				}
441
			}
442
			// Check if the item source is already shared with the user, either from the same owner or a different user
443
			if ($checkExists = self::getItems($itemType, $itemSource, self::$shareTypeUserAndGroups,
444
				$shareWith, null, self::FORMAT_NONE, null, 1, true, true)) {
445
				// Only allow the same share to occur again if it is the same
446
				// owner and is not a user share, this use case is for increasing
447
				// permissions for a specific user
448
				if ($checkExists['uid_owner'] != $uidOwner || $checkExists['share_type'] == $shareType) {
449
					$message = 'Sharing %s failed, because this item is already shared with %s';
450
					$message_t = $l->t('Sharing %s failed, because this item is already shared with %s', array($itemSourceName, $shareWith));
451
					\OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName, $shareWith), \OCP\Util::DEBUG);
452
					throw new \Exception($message_t);
453
				}
454
			}
455
			if ($checkExists = self::getItems($itemType, $itemSource, self::SHARE_TYPE_USER,
456
				$shareWith, null, self::FORMAT_NONE, null, 1, true, true)) {
457
				// Only allow the same share to occur again if it is the same
@@ 455-466 (lines=12) @@
452
					throw new \Exception($message_t);
453
				}
454
			}
455
			if ($checkExists = self::getItems($itemType, $itemSource, self::SHARE_TYPE_USER,
456
				$shareWith, null, self::FORMAT_NONE, null, 1, true, true)) {
457
				// Only allow the same share to occur again if it is the same
458
				// owner and is not a user share, this use case is for increasing
459
				// permissions for a specific user
460
				if ($checkExists['uid_owner'] != $uidOwner || $checkExists['share_type'] == $shareType) {
461
					$message = 'Sharing %s failed, because this item is already shared with user %s';
462
					$message_t = $l->t('Sharing %s failed, because this item is already shared with user %s', array($itemSourceName, $shareWith));
463
					\OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName, $shareWith), \OCP\Util::ERROR);
464
					throw new \Exception($message_t);
465
				}
466
			}
467
		} else if ($shareType === self::SHARE_TYPE_GROUP) {
468
			if (!\OC::$server->getGroupManager()->groupExists($shareWith)) {
469
				$message = 'Sharing %s failed, because the group %s does not exist';