Code Duplication    Length = 4-4 lines in 4 locations

apps/files_sharing/lib/Controller/Share20OcsController.php 4 locations

@@ 285-288 (lines=4) @@
282
			return new Result(null, 404, 'could not delete share');
283
		}
284
285
		if (!$this->canAccessShare($share)) {
286
			$share->getNode()->unlock(ILockingProvider::LOCK_SHARED);
287
			return new Result(null, 404, $this->l->t('Could not delete share'));
288
		}
289
290
		$this->shareManager->deleteShare($share);
291
@@ 489-492 (lines=4) @@
486
487
			$share->setSharedWith($shareWith);
488
			$share->setPermissions($permissions);
489
		} else {
490
			$share->getNode()->unlock(ILockingProvider::LOCK_SHARED);
491
			return new Result(null, 400, $this->l->t('Unknown share type'));
492
		}
493
494
		$share->setShareType($shareType);
495
		$share->setSharedBy($this->currentUser->getUID());
@@ 702-705 (lines=4) @@
699
700
		$share->getNode()->lock(\OCP\Lock\ILockingProvider::LOCK_SHARED);
701
702
		if (!$this->canAccessShare($share)) {
703
			$share->getNode()->unlock(ILockingProvider::LOCK_SHARED);
704
			return new Result(null, 404, $this->l->t('Wrong share ID, share doesn\'t exist'));
705
		}
706
707
		$permissions = $this->request->getParam('permissions', null);
708
		$password = $this->request->getParam('password', null);
@@ 993-996 (lines=4) @@
990
		$node->lock(\OCP\Lock\ILockingProvider::LOCK_SHARED);
991
992
		// this checks that we are either the owner or recipient
993
		if (!$this->canAccessShare($share)) {
994
			$node->unlock(ILockingProvider::LOCK_SHARED);
995
			return new Result(null, 404, $this->l->t('Wrong share ID, share doesn\'t exist'));
996
		}
997
998
		// only recipient can accept/reject share
999
		if ($share->getShareOwner() === $this->currentUser->getUID() ||