Code Duplication    Length = 6-8 lines in 2 locations

lib/private/Share/Share.php 2 locations

@@ 846-851 (lines=6) @@
843
					}
844
				}
845
846
				if (\OCP\Util::isPublicLinkPasswordRequired() && empty($shareWith)) {
847
					$message = 'You need to provide a password to create a public link, only protected links are allowed';
848
					$message_t = $l->t('You need to provide a password to create a public link, only protected links are allowed');
849
					\OCP\Util::writeLog('OCP\Share', $message, \OCP\Util::DEBUG);
850
					throw new \Exception($message_t);
851
				}
852
853
				if ($updateExistingShare === false &&
854
					self::isDefaultExpireDateEnabled() &&
@@ 1365-1372 (lines=8) @@
1362
		$l = \OC::$server->getL10N('lib');
1363
1364
		if ($date == '') {
1365
			if (\OCP\Util::isDefaultExpireDateEnforced()) {
1366
				$warning = 'Cannot clear expiration date. Shares are required to have an expiration date.';
1367
				$warning_t = $l->t('Cannot clear expiration date. Shares are required to have an expiration date.');
1368
				\OCP\Util::writeLog('OCP\Share', $warning, \OCP\Util::WARN);
1369
				throw new \Exception($warning_t);
1370
			} else {
1371
				$date = null;
1372
			}
1373
		} else {
1374
			$date = self::validateExpireDate($date, $shareTime, $itemType, $itemSource);
1375
		}