Code Duplication    Length = 30-30 lines in 2 locations

lib/Circles/FileSharingBroadcaster.php 1 location

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

lib/GlobalScale/FileShare.php 1 location

@@ 236-265 (lines=30) @@
233
	 * @param SharesToken $sharesToken
234
	 * @param string $password
235
	 */
236
	private function sharedByMail(
237
		Circle $circle, IShare $share, string $email, SharesToken $sharesToken, string $password
238
	) {
239
		// genelink
240
		$link = $this->urlGenerator->linkToRouteAbsolute(
241
			'files_sharing.sharecontroller.showShare',
242
			['token' => $sharesToken->getToken()]
243
		);
244
245
		$lang = $this->configService->getCoreValueForUser($share->getSharedBy(), 'lang', '');
246
		if ($lang !== '') {
247
			$this->l10n = OC::$server->getL10N(Application::APP_NAME, $lang);
248
		}
249
250
		try {
251
			$this->sendMail(
252
				$share->getNode()
253
					  ->getName(), $link,
254
				MiscService::getDisplay($share->getSharedBy(), Member::TYPE_USER),
255
				$circle->getName(), $email
256
			);
257
			$this->sendPasswordByMail(
258
				$share, MiscService::getDisplay($share->getSharedBy(), Member::TYPE_USER),
259
				$email, $password
260
			);
261
		} catch (Exception $e) {
262
			OC::$server->getLogger()
263
					   ->log(1, 'Circles::sharedByMail - mail were not sent: ' . $e->getMessage());
264
		}
265
	}
266
267
268
	/**