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

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