Code Duplication    Length = 30-30 lines in 2 locations

lib/Circles/FileSharingBroadcaster.php 1 location

@@ 404-433 (lines=30) @@
401
	 * @param SharesToken $sharesToken
402
	 * @param string $password
403
	 */
404
	private function sharedByMail(
405
		Circle $circle, IShare $share, string $email, SharesToken $sharesToken, string $password
406
	) {
407
		// genelink
408
		$link = $this->urlGenerator->linkToRouteAbsolute(
409
			'files_sharing.sharecontroller.showShare',
410
			['token' => $sharesToken->getToken()]
411
		);
412
413
		$lang = $this->configService->getCoreValueForUser($share->getSharedBy(), 'lang', '');
414
		if ($lang !== '') {
415
			$this->l10n = OC::$server->getL10N(Application::APP_NAME, $lang);
416
		}
417
418
		try {
419
			$this->sendMail(
420
				$share->getNode()
421
					  ->getName(), $link,
422
				MiscService::getDisplay($share->getSharedBy(), Member::TYPE_USER),
423
				$circle->getName(), $email
424
			);
425
			$this->sendPasswordByMail(
426
				$share, MiscService::getDisplay($share->getSharedBy(), Member::TYPE_USER),
427
				$email, $password
428
			);
429
		} catch (Exception $e) {
430
			OC::$server->getLogger()
431
					   ->log(1, 'Circles::sharedByMail - mail were not sent: ' . $e->getMessage());
432
		}
433
	}
434
435
436
	/**

lib/GlobalScale/FileShare.php 1 location

@@ 277-306 (lines=30) @@
274
	 * @param SharesToken $sharesToken
275
	 * @param string $password
276
	 */
277
	private function sharedByMail(
278
		Circle $circle, IShare $share, string $email, SharesToken $sharesToken, string $password
279
	) {
280
		// genelink
281
		$link = $this->urlGenerator->linkToRouteAbsolute(
282
			'files_sharing.sharecontroller.showShare',
283
			['token' => $sharesToken->getToken()]
284
		);
285
286
		$lang = $this->configService->getCoreValueForUser($share->getSharedBy(), 'lang', '');
287
		if ($lang !== '') {
288
			$this->l10n = OC::$server->getL10N(Application::APP_NAME, $lang);
289
		}
290
291
		try {
292
			$this->sendMail(
293
				$share->getNode()
294
					  ->getName(), $link,
295
				MiscService::getDisplay($share->getSharedBy(), Member::TYPE_USER),
296
				$circle->getName(), $email
297
			);
298
			$this->sendPasswordByMail(
299
				$share, MiscService::getDisplay($share->getSharedBy(), Member::TYPE_USER),
300
				$email, $password
301
			);
302
		} catch (Exception $e) {
303
			OC::$server->getLogger()
304
					   ->log(1, 'Circles::sharedByMail - mail were not sent: ' . $e->getMessage());
305
		}
306
	}
307
308
309
	/**