Code Duplication    Length = 17-20 lines in 2 locations

apps/federatedfilesharing/lib/ocm/CloudFederationProviderFiles.php 2 locations

@@ 409-425 (lines=17) @@
406
	 * @param IShare $share
407
	 * @throws ShareNotFound
408
	 */
409
	protected function executeAcceptShare(IShare $share) {
410
		try {
411
			$fileId = (int)$share->getNode()->getId();
412
			list($file, $link) = $this->getFile($this->getCorrectUid($share), $fileId);
413
		} catch (\Exception $e) {
414
			throw new ShareNotFound();
415
		}
416
417
		$event = $this->activityManager->generateEvent();
418
		$event->setApp('files_sharing')
419
			->setType('remote_share')
420
			->setAffectedUser($this->getCorrectUid($share))
421
			->setSubject(RemoteShares::SUBJECT_REMOTE_SHARE_ACCEPTED, [$share->getSharedWith(), [$fileId => $file]])
422
			->setObject('files', $fileId, $file)
423
			->setLink($link);
424
		$this->activityManager->publish($event);
425
	}
426
427
	/**
428
	 * process notification that the recipient declined a share
@@ 485-504 (lines=20) @@
482
	 * @param IShare $share
483
	 * @throws ShareNotFound
484
	 */
485
	protected function executeDeclineShare(IShare $share) {
486
		$this->federatedShareProvider->removeShareFromTable($share);
487
488
		try {
489
			$fileId = (int)$share->getNode()->getId();
490
			list($file, $link) = $this->getFile($this->getCorrectUid($share), $fileId);
491
		} catch (\Exception $e) {
492
			throw new ShareNotFound();
493
		}
494
495
		$event = $this->activityManager->generateEvent();
496
		$event->setApp('files_sharing')
497
			->setType('remote_share')
498
			->setAffectedUser($this->getCorrectUid($share))
499
			->setSubject(RemoteShares::SUBJECT_REMOTE_SHARE_DECLINED, [$share->getSharedWith(), [$fileId => $file]])
500
			->setObject('files', $fileId, $file)
501
			->setLink($link);
502
		$this->activityManager->publish($event);
503
504
	}
505
506
	/**
507
	 * received the notification that the owner unshared a file from you