Code Duplication    Length = 12-12 lines in 2 locations

lib/Fixtures/ShareFix.php 2 locations

@@ 348-359 (lines=12) @@
345
				}
346
			}
347
			// Check if the item source is already shared with the user, either from the same owner or a different user
348
			if ($checkExists = self::getItems($itemType, $itemSource, self::$shareTypeUserAndGroups,
349
				$shareWith, null, self::FORMAT_NONE, null, 1, true, true)) {
350
				// Only allow the same share to occur again if it is the same
351
				// owner and is not a user share, this use case is for increasing
352
				// permissions for a specific user
353
				if ($checkExists['uid_owner'] != $uidOwner || $checkExists['share_type'] == $shareType) {
354
					$message = 'Sharing %s failed, because this item is already shared with %s';
355
					$message_t = $l->t('Sharing %s failed, because this item is already shared with %s', array($itemSourceName, $shareWith));
356
					self::log('NextNote\Fixtures\ShareFix', sprintf($message, $itemSourceName, $shareWith), \OCP\Util::DEBUG);
357
					throw new \Exception($message_t);
358
				}
359
			}
360
			if ($checkExists = self::getItems($itemType, $itemSource, self::SHARE_TYPE_USER,
361
				$shareWith, null, self::FORMAT_NONE, null, 1, true, true)) {
362
				// Only allow the same share to occur again if it is the same
@@ 360-371 (lines=12) @@
357
					throw new \Exception($message_t);
358
				}
359
			}
360
			if ($checkExists = self::getItems($itemType, $itemSource, self::SHARE_TYPE_USER,
361
				$shareWith, null, self::FORMAT_NONE, null, 1, true, true)) {
362
				// Only allow the same share to occur again if it is the same
363
				// owner and is not a user share, this use case is for increasing
364
				// permissions for a specific user
365
				if ($checkExists['uid_owner'] != $uidOwner || $checkExists['share_type'] == $shareType) {
366
					$message = 'Sharing %s failed, because this item is already shared with user %s';
367
					$message_t = $l->t('Sharing %s failed, because this item is already shared with user %s', array($itemSourceName, $shareWith));
368
					self::log('NextNote\Fixtures\ShareFix', sprintf($message, $itemSourceName, $shareWith), \OCP\Util::ERROR);
369
					throw new \Exception($message_t);
370
				}
371
			}
372
		} else if ($shareType === self::SHARE_TYPE_GROUP) {
373
			if (!\OC::$server->getGroupManager()->groupExists($shareWith)) {
374
				$message = 'Sharing %s failed, because the group %s does not exist';