Code Duplication    Length = 6-8 lines in 2 locations

lib/private/Share/Share.php 2 locations

@@ 905-910 (lines=6) @@
902
					}
903
				}
904
905
				if (\OCP\Util::isPublicLinkPasswordRequired() && empty($shareWith)) {
906
					$message = 'You need to provide a password to create a public link, only protected links are allowed';
907
					$message_t = $l->t('You need to provide a password to create a public link, only protected links are allowed');
908
					\OCP\Util::writeLog('OCP\Share', $message, \OCP\Util::DEBUG);
909
					throw new \Exception($message_t);
910
				}
911
912
				if ($updateExistingShare === false &&
913
					self::isDefaultExpireDateEnabled() &&
@@ 1426-1433 (lines=8) @@
1423
		$l = \OC::$server->getL10N('lib');
1424
1425
		if ($date == '') {
1426
			if (\OCP\Util::isDefaultExpireDateEnforced()) {
1427
				$warning = 'Cannot clear expiration date. Shares are required to have an expiration date.';
1428
				$warning_t = $l->t('Cannot clear expiration date. Shares are required to have an expiration date.');
1429
				\OCP\Util::writeLog('OCP\Share', $warning, \OCP\Util::WARN);
1430
				throw new \Exception($warning_t);
1431
			} else {
1432
				$date = null;
1433
			}
1434
		} else {
1435
			$date = self::validateExpireDate($date, $shareTime, $itemType, $itemSource);
1436
		}