Code Duplication    Length = 17-20 lines in 2 locations

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

@@ 352-368 (lines=17) @@
349
	 * @param IShare $share
350
	 * @throws ShareNotFound
351
	 */
352
	protected function executeAcceptShare(IShare $share) {
353
		try {
354
			$fileId = (int)$share->getNode()->getId();
355
			list($file, $link) = $this->getFile($this->getCorrectUid($share), $fileId);
356
		} catch (\Exception $e) {
357
			throw new ShareNotFound();
358
		}
359
360
		$event = $this->activityManager->generateEvent();
361
		$event->setApp('files_sharing')
362
			->setType('remote_share')
363
			->setAffectedUser($this->getCorrectUid($share))
364
			->setSubject(RemoteShares::SUBJECT_REMOTE_SHARE_ACCEPTED, [$share->getSharedWith(), [$fileId => $file]])
365
			->setObject('files', $fileId, $file)
366
			->setLink($link);
367
		$this->activityManager->publish($event);
368
	}
369
370
	/**
371
	 * process notification that the recipient declined a share
@@ 428-447 (lines=20) @@
425
	 * @param IShare $share
426
	 * @throws ShareNotFound
427
	 */
428
	protected function executeDeclineShare(IShare $share) {
429
		$this->federatedShareProvider->removeShareFromTable($share);
430
431
		try {
432
			$fileId = (int)$share->getNode()->getId();
433
			list($file, $link) = $this->getFile($this->getCorrectUid($share), $fileId);
434
		} catch (\Exception $e) {
435
			throw new ShareNotFound();
436
		}
437
438
		$event = $this->activityManager->generateEvent();
439
		$event->setApp('files_sharing')
440
			->setType('remote_share')
441
			->setAffectedUser($this->getCorrectUid($share))
442
			->setSubject(RemoteShares::SUBJECT_REMOTE_SHARE_DECLINED, [$share->getSharedWith(), [$fileId => $file]])
443
			->setObject('files', $fileId, $file)
444
			->setLink($link);
445
		$this->activityManager->publish($event);
446
447
	}
448
449
	/**
450
	 * received the notification that the owner unshared a file from you