Code Duplication    Length = 12-12 lines in 2 locations

lib/private/Share/Share.php 2 locations

@@ 471-482 (lines=12) @@
468
				}
469
			}
470
			// Check if the item source is already shared with the user, either from the same owner or a different user
471
			if ($checkExists = self::getItems($itemType, $itemSource, self::$shareTypeUserAndGroups,
472
				$shareWith, null, self::FORMAT_NONE, null, 1, true, true)) {
473
				// Only allow the same share to occur again if it is the same
474
				// owner and is not a user share, this use case is for increasing
475
				// permissions for a specific user
476
				if ($checkExists['uid_owner'] != $uidOwner || $checkExists['share_type'] == $shareType) {
477
					$message = 'Sharing %s failed, because this item is already shared with %s';
478
					$message_t = $l->t('Sharing %s failed, because this item is already shared with %s', array($itemSourceName, $shareWith));
479
					\OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName, $shareWith), \OCP\Util::DEBUG);
480
					throw new \Exception($message_t);
481
				}
482
			}
483
			if ($checkExists = self::getItems($itemType, $itemSource, self::SHARE_TYPE_USER,
484
				$shareWith, null, self::FORMAT_NONE, null, 1, true, true)) {
485
				// Only allow the same share to occur again if it is the same
@@ 483-494 (lines=12) @@
480
					throw new \Exception($message_t);
481
				}
482
			}
483
			if ($checkExists = self::getItems($itemType, $itemSource, self::SHARE_TYPE_USER,
484
				$shareWith, null, self::FORMAT_NONE, null, 1, true, true)) {
485
				// Only allow the same share to occur again if it is the same
486
				// owner and is not a user share, this use case is for increasing
487
				// permissions for a specific user
488
				if ($checkExists['uid_owner'] != $uidOwner || $checkExists['share_type'] == $shareType) {
489
					$message = 'Sharing %s failed, because this item is already shared with user %s';
490
					$message_t = $l->t('Sharing %s failed, because this item is already shared with user %s', array($itemSourceName, $shareWith));
491
					\OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName, $shareWith), \OCP\Util::ERROR);
492
					throw new \Exception($message_t);
493
				}
494
			}
495
		} else if ($shareType === self::SHARE_TYPE_GROUP) {
496
			if (!\OC::$server->getGroupManager()->groupExists($shareWith)) {
497
				$message = 'Sharing %s failed, because the group %s does not exist';