Code Duplication    Length = 7-9 lines in 2 locations

apps/files_sharing/lib/Controller/ShareAPIController.php 2 locations

@@ 516-522 (lines=7) @@
513
			}
514
			$share->setSharedWith($shareWith);
515
516
			if ($sendPasswordByTalk === 'true') {
517
				if (!$this->appManager->isEnabledForUser('spreed')) {
518
					throw new OCSForbiddenException($this->l->t('Sharing %s sending the password by Nextcloud Talk failed because Nextcloud Talk is not enabled', [$path->getPath()]));
519
				}
520
521
				$share->setSendPasswordByTalk(true);
522
			}
523
		} else if ($shareType === Share::SHARE_TYPE_CIRCLE) {
524
			if (!\OC::$server->getAppManager()->isEnabledForUser('circles') || !class_exists('\OCA\Circles\ShareByCircleProvider')) {
525
				throw new OCSNotFoundException($this->l->t('You cannot share to a Circle if the app is not enabled'));
@@ 866-874 (lines=9) @@
863
					$share->setPassword($password);
864
				}
865
866
				if ($sendPasswordByTalk === 'true') {
867
					if (!$this->appManager->isEnabledForUser('spreed')) {
868
						throw new OCSForbiddenException($this->l->t('Sharing sending the password by Nextcloud Talk failed because Nextcloud Talk is not enabled'));
869
					}
870
871
					$share->setSendPasswordByTalk(true);
872
				} else {
873
					$share->setSendPasswordByTalk(false);
874
				}
875
			}
876
877
			if ($expireDate === '') {